Skip to main content

Module cli

Module cli 

Source
Expand description

The argument grammar mimetype and mimeopen share.

Both are drop-ins for the commands of the same name in perl-file-mimeinfo, and both are invoked by xdg-open, so the grammar is the compatibility claim: bundled short options (-bl de), --long=value as well as --long value, -- ending the options, and a bare - being a filename rather than a flag.

It lives here because it was written twice. The two parsers were identical but for the program name in four error strings, with their own tests each — so a fix to bundling or to -- had to be made and re-tested twice, and a divergence would have meant two commands that parse their shared options differently. That is the one kind of bug a compatibility command cannot afford.

Modules§

exit
Exit codes, which are the reference implementation’s own.

Structs§

Parsed
What a command line turned out to be: the options given, in order, each with its value; and everything that was not an option.

Functions§

database_dirs
The directories to read the database from: what --database named, or the XDG ones.
parse
Splits a command line against an option table.
shown_name
A filename as printed. On a terminal the reference quotes it, so a name with a space or a newline in it cannot be misread; piped, it prints the name raw, which is what a script downstream needs.

Type Aliases§

Option_
One option: its long name, its short letter if it has one, and whether it takes a value.