arapelle / bashtlk

MIT License
0 stars 0 forks source link

Enable commandf to take options. #12

Open arapelle opened 1 year ago

arapelle commented 1 year ago

Option -- breaks the getopts | getopt loop.

Call example: commandf -v var PARAM [--] echo "message"

Options: -n: : no output -v: : output to variable -f: : output to file -i : output if fails -t: call time $*


?? if we split out and err. (?? in another task?) https://stackoverflow.com/questions/11027679/capture-stdout-and-stderr-into-different-variables --no-out --no-err --outs-var --outs-file --out-var --err-var --out-file --err-file

https://stackoverflow.com/questions/2493642/how-can-a-linux-unix-bash-script-get-its-own-pid

arapelle commented 1 year ago

getopts already breaks if -- is encountered. It is not needed for commandf.

arapelle commented 1 year ago
while getopts "a:b:" option
do
    case "${option}" in
        a)
            echo "A: ${OPTARG}"
            ;;
        b)
            echo "B: ${OPTARG}"
            ;;
        *)
            echo "Whut Oo  ${option}"
            ;;
    esac
done
shift $((OPTIND-1))

echofmt "{blue}remaining"
exit 0