I would love to be able to paste a command into the terminal, add a flag, and have the program explain the options to me and what they mean, like so:
$ ls -I*.txt -S -w120 -1 --explain
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
-I*.txt
do not list implied entries matching shell `*.txt'
-S
sort by file size, largest first
-w120
set output width to 120. 0 means no limit
-1
list one file per line. Avoid '\n' with -q or -b
This would save me so much time, especially for commands with a lot of options and longer man pages. Every new shell program I write will have this feature.
Obviously the --explain
flag isn’t perfect because it’s not a reserved word or anything and might collide with an existing program somewhere out there. Maybe ---explain
, and we say that triple-dash options are reserved for parser-specific things?
And I feel like you could modify e.g. Python’s argparse library, and enable this functionality en masse for every python program that uses it. Have getopt-like libraries handle it transparently so that programs don’t even have to be modified.
Somebody get on that.
Leave a Reply