3 ms·
On my backburner is "argparse-sh", a program that does command line parsing for bash scripts written in Rust: https://github.com/Hounshell/argparse-sh https://g
by shaftway 2y ago
On my backburner is "argparse-sh", a program that does command line parsing for bash scripts written in Rust: https://github.com/Hounshell/argparse-sh https://github.com/Hounshell/argparse-sh
This is my first "real" Rust program, so it's probably pretty terrible. When you run it you give it a bunch of command line arguments to define what arguments exist, their format, etc. Then you give it a `--` and forward the arguments your script was called with. The output is a shell script that sets a bunch of environment variables that you can then use to access the values.
Here's the canonical example:
$ cat demo.sh
eval "$(argparse-sh \
--string text \
-- "$@")";
echo "$TEXT"
$ ./demo.sh "Hello World"
Hello World
At this point I think I've got a decent feature set and I'm letting it soak in a few of my scripts to try to flush out usability problems.