From 343946c08902aecad2b52cdda5761e6246825e99 Mon Sep 17 00:00:00 2001 From: bill-auger Date: Sat, 19 Sep 2020 07:01:34 -0400 Subject: sq - docs --- src/chroot-tools/librechroot | 28 ++++++++++++++-------------- src/lib/messages.sh | 17 +++++++++++------ 2 files changed, 25 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index 9367ef8..2462f4b 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -216,6 +216,8 @@ readonly DEF_PACMANCONF_DIR=/usr/share/pacman/defaults usage() { eval "$(calculate_directories)" + local mount_msg="$(_ 'PATH[:INSIDE_PATH[:OPTIONS]]')" + print "Usage: %s [OPTIONS] COMMAND [ARGS...]" "${0##*/}" echo print 'Interacts with a libre "archroot" (similarly to `arch-chroot`).' @@ -287,20 +289,18 @@ usage() { prose 'Creating/deleting/synchronizing a copy, can be relatively slow; but can be very fast, if $CHROOTDIR is on a btrfs partition.' echo - flag 'Options:' \ - "-n <$(_ NAME)>" 'Name of the chroot to use' \ - "-l <$(_ COPY)>" 'Name of, or absolute path to, the copy to use' \ - "-C <$(_ FILE)>" 'Copy this file to chroot as: `/etc/pacman.conf` - This option is mutually exclusive with -A.' \ - "-M <$(_ FILE)>" 'Copy this file to chroot as: `/etc/makepkg.conf` - This option is mutually exclusive with -A.' \ - "-A <$(_ CARCH)>" 'Specify the architecture of a new `root` seed. - This option is mutually exclusive with -C and -M.' \ - "-N" 'Disable networking in the chroot' \ - "-w <$(_ 'PATH[:INSIDE_PATH[:OPTIONS]]')>" 'Bind mount a file or - directory, read/write' \ - "-r <$(_ 'PATH[:INSIDE_PATH[:OPTIONS]]')>" 'Bind mount a file or - directory, read-only' + flag 'Options:' \ + "-n <$(_ NAME)>" 'Name of the chroot to use' \ + "-l <$(_ COPY)>" 'Name of, or absolute path to, the copy to use' \ + "-C <$(_ FILE)>" 'Copy this file to chroot as: `/etc/pacman.conf` + This option is mutually exclusive with -A.' \ + "-M <$(_ FILE)>" 'Copy this file to chroot as: `/etc/makepkg.conf` + This option is mutually exclusive with -A.' \ + "-A <$(_ CARCH)>" 'Specify the architecture of a new `root` seed. + This option is mutually exclusive with -C and -M.' \ + "-N" 'Disable networking in the chroot' \ + "-w <${mount_msg}>" 'Bind mount a file or directory, read/write' \ + "-r <${mount_msg}>" 'Bind mount a file or directory, read-only' echo flag 'Commands (create/copy/delete):' \ 'make' 'Create a `root` seed and working copy' \ diff --git a/src/lib/messages.sh b/src/lib/messages.sh index a43533a..b96c637 100644 --- a/src/lib/messages.sh +++ b/src/lib/messages.sh @@ -106,15 +106,20 @@ bullet() { printf -- "$mesg" "$@" | fmt -u -w 71 | sed -e '1s/^/ - /' -e '2,$s/^/ /' } -# Usage: flag [FLAG DESCRIPTION|HEADING:]... +# Usage: flag |HEADING:] [FLAG DESCRIPTION [FLAG DESCRIPTION]...] # -# Print a flag and description formatted for --help text. +# Print formatted for --help text, a heading, to preceed a (possibly empty) +# list of flags and their description, or a list of flags and descriptions, +# with an optional heading. # -# ex: flag '-C ' 'Use this file instead of pacman.conf' +# ex: flag 'Options:' '-C ' 'Use this file instead of pacman.conf' +# ex: flag 'Options:' +# flag '-C ' 'Use this file instead of pacman.conf' \ +# '-n ' 'Name of the chroot to use' # -# The descriptions and headings are fed through gettext, the flags ar -# not, so if part of a flag needs to be translated, you must handle -# that explicitly, using $(_ ): +# The headings and descriptions are fed through gettext; but the flags are not. +# If part of a flag needs to be translated, you must handle that explicitly, +# using the translation helper directly, of the form $(_ ). # # ex: flag "-C <$(_ FILE)>" 'Use this file instead of pacman.conf' # -- cgit v1.2.2