idank / explainshell

match command-line arguments to their help text
GNU General Public License v3.0
12.98k stars 778 forks source link

Export usages as docopt #313

Open fenollp opened 1 year ago

fenollp commented 1 year ago

(Opening this to track but I'll probably end up implementing this myself.)

I love explainshell and I love docopt.org. I wish there was a docopt repo of many common commands so docopt adoption and usage would grow faster. This repo does the dirty work of making sense of many/various manpages so they can be indexed and matched against an actual call.

I suggest to store these parsed manpages as docopt usage strings and to use docopt machinery to match the call.

If matching needs optimizing, one could also just provide an API that, given a command or a call, gives back a docopt usage string for that command.

idank commented 1 year ago

I'd be scared of tying a generic tool like explainshell to the format of a particular tool. I also wouldn't be surprised if some evil command arguments weren't expressible in docopt.

I do think explainshell needs an internal for its index though, I'm just not sure this is the right one.