What clop reads
clop obtains help text two ways, and detects a version one way:
| Source | How |
|---|---|
Run program --help | when you name a PROGRAM |
| Read help text from a file | clop -f FILE |
| Read help text from standard input | clop - (e.g. prog --help \| clop -) |
Detect the version via program --version | automatically, when you name a PROGRAM |
That is the whole list. If a program prints one option per line, the layout used by GNU coreutils, BusyBox, and Toybox, then clop counts it well.
What it does not handle (yet)
clop is deliberately small, so several common "give me help" conventions are
left out. In each case, capture the text yourself and feed it in with -f or -:
-h: clop always invokes--help. For a program that only answers-h, runprog -h > help.txtand thenclop -f help.txt.--usage,helpsubcommands,--help-all, e.g.git help,go help. Pipe instead:git help -a | clop -.manpages: clop does not runman, and man-page formatting is not the layout it parses.infopages: not supported, so treat them likemanpages.- Subcommand help: clop reads the top-level
--helponly. For a subcommand, rungit commit --help | clop --name git-commit -. - Wrapped or table-style entries: options whose name does not start a line with a dash may be miscounted.
In short, clop reliably handles --help, -f FILE, and stdin for
one-option-per-line layouts. Anything else, such as -h, man, info,
subcommand trees, or unusual formatting, you can almost always feed in manually.
Security
Naming a program makes clop run program --help (and program --version),
exactly as if you had typed them yourself. Only pass names of programs you
trust. To analyze help text without running anything, capture it first:
untrusted --help > help.txt
clop -f help.txt
The script never passes your input to a shell, never uses eval, and treats
help text strictly as text (shell glob characters are not expanded).