4 ms·
If I’m looking for a specific flag, or trying to understand what a specific flag does, I prefer to pipe the --help output to grep: ./my_cli —-help | grep -
by 10000truths 5y ago
If I’m looking for a specific flag, or trying to understand what a specific flag does, I prefer to pipe the --help output to grep:
./my_cli —-help | grep -C 2 —- —-someflag
- anjbe 5y agoI tend to avoid doing this, for reasons someone else described in a comment (https://news.ycombinator.com/item?id=30993390 https://news.ycombinator.com/item?id=30993390): some programs spit --help output to stdout, but others to stderr, so you wind up running it a second time as “my_cli --help 2>&1 | grep ...”. In addition, if I don’t perfectly know what I’m searching for, I’ll often get the regular expression wrong. So I prefer to check the manpage first, since it’s a lot quicker to try different search strings in my pager than by repeatedly modifying my previous command string in the shell.