Skip to main content

Module cli

Module cli 

Source
Expand description

Shared command-line plumbing: colour, argument parsing and the renderers.

NO CLI FRAMEWORK. Argument parsing here is a few dozen lines over std::env::args_os, which is the house rule and is also the only way to get the exact behaviour these tools need: -- ends options so a file genuinely named --force.jpg is a file, and an unknown flag is an error rather than a positional.

Structs§

Args
A parsed command line: flags that were present, options with values, and the positionals.

Enums§

Parsed

Constants§

BOLD
DIM
GRN
OFF
RED
YEL

Functions§

c
Wrap in a colour, or do not, depending on where output is going.
colour_enabled
command_path
A path as it should be typed back at a shell. The -- matters: without it a file named --force.jpg reads as a flag, and the suggestion this tool prints would not work.
for_each_file
Walk the file list, refusing anything that is not an ordinary file, and hand each survivor to each. Returns true if anything failed, which becomes the exit status.
print_platforms
print_report
Print one inspection report the way snitch prints it. Returns true when something went wrong enough for a non-zero exit, which today means only a failed C2PA check.
quiet_on_closed_pipe
Let a closed pipe end the process quietly, the way every other Unix command does.
shell_quote
thousands