]> git.ipfire.org Git - thirdparty/mkosi.git/commit
mkosi: rework --help to print command syntax 1249/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 28 Oct 2022 16:46:13 +0000 (18:46 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 21 Nov 2022 09:10:35 +0000 (10:10 +0100)
commiteaab4cef5bd75d32310e9477bf2319e402692437
tree7b8dd0a643ab9f0b07e0bc5bce9ec102f0c91c93
parentf53c7d4edd15fc619448ba5c9d48d482ff8fb173
mkosi: rework --help to print command syntax

Command list and syntax is the most interesting part of the output.
But because of how argparse works, we were showing this part very
briefly and buried in other options. Instead of relying on the autogenerated
description, let's reuse the list from the man page.
Because a literal text is added, the lines for verbs and --help
and --version are suppressed.

I changed "Distribution" to "Distribution options" and so on for each
option group. The additional word connects the synopsis (which says
"[options…]" with the list below.

Output:
$ bin/mkosi --help| head -n 20
usage:
       mkosi [options...] summary
       mkosi [options...] build [script parameters...]
       mkosi [options...] shell [command line...]
       mkosi [options...] boot [nspawn settings...]
       mkosi [options...] qemu [qemu parameters...]
       mkosi [options...] ssh [command line...]
       mkosi [options...] clean
       mkosi [options...] serve
       mkosi [options...] bump
       mkosi [options...] genkey
       mkosi [options...] help
       mkosi -h | --help
       mkosi --version

Build Bespoke OS Images

Distribution options:
  -d, --distribution {fedora,debian,...

When printed on the console, summary/build/shell/… are bold.
mkosi/__init__.py