3 ms·
> But I also annoy myself as a user when I can't remember what the syntax options are for the CLI that I coded so I end up having to open the source code and re
by alright2565 3y ago
> But I also annoy myself as a user when I can't remember what the syntax options are for the CLI that I coded so I end up having to open the source code and re-examine the argc and argv sections to see what the spelling or ordering is.
I try to avoid this in two ways:
1. I use the history in my terminal to search for previous invocations of the command, which tends to give me a good set of examples of how it should be used.
2. For anything but the quickest and dirtiest CLI tools, I like to use a declarative parameter parser like docopt or argparse. This forces me to spend a couple extra minutes writing some docs and makes the --help useful.