From 118da1cefaeb8e5660ded520f2d90408de8ec15c Mon Sep 17 00:00:00 2001 From: Doug Wegscheid Date: Sun, 21 Jun 2026 12:38:50 -0400 Subject: [PATCH] Put argparse.bash on $PATH, not with scripts. --- README.rst | 10 +++++----- argparse.bash | 2 +- example.sh | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index 3122dc0..749f3b6 100644 --- a/README.rst +++ b/README.rst @@ -9,8 +9,8 @@ Use Python's argparse module in shell scripts The function ``argparse`` parses its arguments using ``argparse.ArgumentParser``. The command line options are defined in -the function's stdin. ``argparse.bash`` should be in the same -directory as a script that uses it. +the function's stdin. ``argparse.bash`` should be on the $PATH or in +the current directory. Python 2.7 or 3.5+ is required. See https://docs.python.org/2.7/library/argparse.html for a description of @@ -28,7 +28,7 @@ Get ``argparse.bash`` wget https://raw.githubusercontent.com/nhoffman/argparse-bash/master/argparse.bash chmod +x argparse.bash -Then move the file into the same directory as any scripts that will use it. +Then move the file into a directory that is on your $PATH (/usr/local/bin or $HOME/bin). Alternatively, you can paste the body of the ``argparse()`` function into your script (in which case you would of course omit the line @@ -45,7 +45,7 @@ Here's an example, ``example.sh`` #!/usr/bin/env bash ARGPARSE_DESCRIPTION="Sample script description" # this is optional - source $(dirname $0)/argparse.bash || exit 1 + source argparse.bash || exit 1 argparse "$@" <