kpatch: reformat usage message

In prepraration for "kpatch load --replace", reformat the usage message
to give more room for the command descriptions.  Also move the
formatting logic to its own function.
This commit is contained in:
Josh Poimboeuf 2014-04-28 16:15:06 -05:00
parent b7f32f8ade
commit 354b399be5

View File

@ -28,20 +28,24 @@ SYSDIR="/usr/lib/kpatch/$KERNELRELEASE"
USERDIR="/var/lib/kpatch/$KERNELRELEASE"
SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))"
usage_cmd() {
printf ' %-20s\n %s\n' "$1" "$2" >&2
}
usage () {
echo "usage: kpatch <command> [<args>]" >&2
echo >&2
echo "Valid commands:" >&2
printf ' %-20s %s\n' "install <module>" "install patch module to the initrd to be loaded at boot" >&2
printf ' %-20s %s\n' "uninstall <module>" "uninstall patch module from the initrd" >&2
usage_cmd "install <module>" "install patch module to the initrd to be loaded at boot"
usage_cmd "uninstall <module>" "uninstall patch module from the initrd"
echo >&2
printf ' %-20s %s\n' "load --all" "load all installed patch modules into the running kernel" >&2
printf ' %-20s %s\n' "load <module>" "load patch module into the running kernel" >&2
printf ' %-20s %s\n' "unload <module>" "unload patch module from the running kernel" >&2
usage_cmd "load --all" "load all installed patch modules into the running kernel"
usage_cmd "load <module>" "load patch module into the running kernel"
usage_cmd "unload <module>" "unload patch module from the running kernel"
echo >&2
printf ' %-20s %s\n' "info <module>" "show information about a patch module" >&2
usage_cmd "info <module>" "show information about a patch module"
echo >&2
printf ' %-20s %s\n' "list" "list installed patch modules" >&2
usage_cmd "list" "list installed patch modules"
exit 1
}