diff --git a/argparse.bash b/argparse.bash index 25f935e..2f273cf 100755 --- a/argparse.bash +++ b/argparse.bash @@ -13,7 +13,12 @@ # MIT License - Copyright (c) 2015 Noah Hoffman argparse(){ - argparser=$(mktemp 2>/dev/null || mktemp -t argparser) + local cmd=${FUNCNAME[1]} + if [[ $cmd == "main" ]]; then + cmd=$0 + fi + + local argparser=$(mktemp 2>/dev/null || mktemp -t argparser) cat > "$argparser" <