Description
Now almost all command line arguments have a short and a long name. Most short names are undecipherable or misleading without reading through the help. Also, few argument names leak implementation details. We shouldn't expose short switches for more obscure functionality at all and the ones we are exposing should be as intuitive as possible.
I think we should double think about the names of these switches before 1.0:
-n
: It means dry-run in most command line programs and it may make sense to have a dry-run switch in the future, but right now it is configuring entropy calculation.-e
: Output location can be configured either via positional argument or-o
many times. As we are supporting arbitrary input files, we shouldn't use a positional argument though.--process-num
/-p
: There is no generally established name here. Some times-j
is used to denote "jobs", or-p
to indicate parallelism. I think we shouldn't indicate on our public API that we are using processes for parallelism. (It is also true for the actualprocess_file
function too)--show-external-dependencies
this is an odd one we agreed about in the past that it doesn't really seem right and may make sense to use a subcommand instead but we didn't want to introduce them just for this functionality. If we are to use subcommands elsewhere, we should reconsider this as well
Suggested help output (for existing functionality)
$ unblob --help
Usage: unblob [OPTIONS] FILES...
A tool for getting information out of any kind of binary blob.
See '--show-external-dependencies' for details on required 3rd party tools.
Common Options:
--help Show this message and exit.
-v, --verbose Verbosity level, counting, maximum level: 3
(use: -v, -vv, -vvv)
-V, --version
Extraction Options:
-d, --depth INTEGER RANGE Recursion depth. How deep should we extract
containers. [default: 10; x>=1]
-j, --jobs INTEGER RANGE
Number of jobs to process files
parallelly. [default: 8; x>=1]
-o, --output DIRECTORY Extract the files to this directory. Will be
created if doesn't exist.
-P, --plugins-path PATH Load plugins from the provided path.
Special Options:
--entropy-depth INTEGER RANGE
Entropy calculation depth. How deep should
we calculate entropy for unknown files? 1
means input files only, 0 turns it off.
[default: 1; x>=0]
--show-external-dependencies Shows commands need to be available for
unblob to work properly
Suggested help format containing potential future options
$ unblob --help
Usage: unblob [OPTIONS] FILES...
A tool for getting information out of any kind of binary blob.
See '--show-external-dependencies' for details on required 3rd party tools.
Common Options:
--help Show this message and exit.
-v, --verbose Verbosity level, counting, maximum level: 3
(use: -v, -vv, -vvv)
-V, --version
Extraction Options:
-f, --force Overwrite already existing output
-d, --depth INTEGER RANGE Recursion depth. How deep should we extract
containers. [default: 10; x>=1]
-j, --jobs INTEGER RANGE
Number of jobs to process files
parallelly. [default: 8; x>=1]
-o, --output DIRECTORY Extract the files to this directory. Will be
created if doesn't exist.
-P, --plugins-path PATH Load plugins from the provided path.
Special Options:
--extract-config [KEY=VALUE...] Control finer details of extraction process.
Plugins can register extra options.
See '--extract-config help' for details.
--show-external-dependencies Shows commands need to be available for
unblob to work properly
$ unblob --extract-config help
Usage: unblob --extract-config [KEY=VALUE...]
The following configuration options are available:
cleanup_output Remove intermediate files [...]
entropy_depth Entropy calculation depth. How deep should
we calculate entropy for unknown files? 1
means input files only, 0 turns it off.
[default: 1; x>=0]
ignore_magic Do not extract files matching to the given magic
Potential future direction with subcommands
Currently we have only the default implicit extract
and the somewhat clunky show-external-dependencies
functionality which doesn't warrant the addition of subcommands. If we want to add in the future e.g. Forcing a given extractor to a file, it could make sense to add subcommands (I know, I know, unpack and extract are awful verbs to use together...)
$ unblob --help
Usage: unblob [SUBCOMMAND]
Options:
--help Show this message and exit.
-v, --verbose Verbosity level, counting, maximum level: 3
(use: -v, -vv, -vvv)
-V, --version
Subcommands:
extract Extracts a binary blob. Default command if unspecified.
unpack Unpacks a file using the specified extractor
help Show this help, or the help of the given subcommand