From af51249a9ba31a11d026f7c704b32515b8b98931 Mon Sep 17 00:00:00 2001 From: Alan Berezin Date: Sun, 11 Oct 2020 09:02:31 -0700 Subject: [PATCH 1/2] add epilog --- argparse.bash | 3 ++- example.sh | 1 + test.py | 15 ++++++++++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/argparse.bash b/argparse.bash index 25f935e..e54dc7d 100755 --- a/argparse.bash +++ b/argparse.bash @@ -28,7 +28,8 @@ class MyArgumentParser(argparse.ArgumentParser): sys.exit(1) parser = MyArgumentParser(prog=os.path.basename("$0"), - description="""$ARGPARSE_DESCRIPTION""") + description="""$ARGPARSE_DESCRIPTION""", + epilog="""$ARGPARSE_EPILOG""") EOF # stdin to this function should contain the parser definition diff --git a/example.sh b/example.sh index 128cb09..f41b03a 100755 --- a/example.sh +++ b/example.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash ARGPARSE_DESCRIPTION="Sample script description" # this is optional +ARGPARSE_EPILOG="This is the epilog." # this is optional source $(dirname $0)/argparse.bash || exit 1 argparse "$@" < Date: Sun, 28 Apr 2024 09:34:54 -0700 Subject: [PATCH 2/2] wip --- example.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/example.sh b/example.sh index f41b03a..33f5802 100755 --- a/example.sh +++ b/example.sh @@ -2,7 +2,9 @@ ARGPARSE_DESCRIPTION="Sample script description" # this is optional ARGPARSE_EPILOG="This is the epilog." # this is optional -source $(dirname $0)/argparse.bash || exit 1 +# shellcheck source=/Users/aberezin/apps/argparse.bash +source "$ARGPARSE_PATH" || exit 1 +#optional way to plave src file: source $(dirname $0)/argparse.bash || exit 1 argparse "$@" <