2 ms·
Neat writeup. I did a very similar thing in Rust, but to solve a different problem. I wanted to be able to easily make nice rich command line arguments for bas
by shaftway 2y ago
Neat writeup.
I did a very similar thing in Rust, but to solve a different problem. I wanted to be able to easily make nice rich command line arguments for bash scripts without cluttering up the script too much. My minimal demo is:
$ cat demo.sh
eval "$(argparse-sh --string text -- "$@")";
echo "$TEXT"
$ ./demo.sh "Hello world"
Hello World
I always think it's valuable to build these things for yourself; maybe not always valuable to ship them. It de-magic-ifies the libraries you use and can only help you grow as a programmer.
I'm still learning as a Rust developer, and I'm sure there are terrible things in my code. The hard part for me is finding ways to make things more idiomatic in isolation. I don't have a code review feedback loop I can use to speed up improvement.
https://github.com/Hounshell/argparse-sh https://github.com/Hounshell/argparse-sh