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 yjftsjthsd-h 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. If this happens often enough, I give in and expend the extra effort rewrite the utility as a GUI app with radio buttons, checkboxes, etc.
Why are you not implementing -h & --help?
- Borg3 3y agoBecause he is lazy :) I use CLI a lot.. Im lazy too. But pretty much 90% of my tools implement --help because some tools are used not that often. If I ever try to use tool that does not have nice and clean --help output I curse :)
- CableNinja 3y agoIt takes like 2 seconds in almost any language to do it too, just do it when you start your code, youll thank yourself later. I even have a sort of template for shell scripts, if any arg will be on the commandline, it gets implemented. For python (using argparse obviously), in my current project i built a toml file that handles the args. It allowed me to do more, like generating code blocks for js for the web frontend, documentation for both the cli and remote api, etc. Actually, now that I think about it, i might chunk that out to its own library.
- tom_ 3y agoA better question is why OP isn't using a library that will do it for them! Python's argparse is pretty good in this respect. Even if you don't supply help text and good metavar names, it'll at least give you --help output showing which options are supported, and adding help text and helpful metavar names is not much additional effort. argparse has inspired a number of knockoffs in other languages, and the ones I've used are pretty good at --help output too. (Or you can write your own! If you've done this not only long enough to not only forget the syntax of command line tools you've written, but also often enough to have recognised this as a repeated trend, the effort involved could be worth it.)