Map --help flag to "man <command>" for more NixOS commands

This commit is contained in:
Eelco Dolstra
2013-10-13 17:35:55 +02:00
parent a042d91290
commit ef72fcc2aa
3 changed files with 18 additions and 47 deletions
@@ -2,14 +2,9 @@
# Shows the usage of this command to the user # Shows the usage of this command to the user
showUsage() showUsage() {
{ exec man nixos-build-vms
echo "Usage: $0 network_expr" exit 1
echo "Options:"
echo
echo "--no-out-link Do not create a 'result' symlink"
echo "--show-trace Shows the output trace"
echo "-h,--help Shows the usage of this command"
} }
# Parse valid argument options # Parse valid argument options
+13 -9
View File
@@ -14,15 +14,19 @@ extraBuildFlags=()
while [ "$#" -gt 0 ]; do while [ "$#" -gt 0 ]; do
i="$1"; shift 1 i="$1"; shift 1
case "$i" in case "$i" in
-I) -I)
given_path="$1"; shift 1 given_path="$1"; shift 1
absolute_path=$(readlink -m $given_path) absolute_path=$(readlink -m $given_path)
extraBuildFlags+=("$i" "/mnt$absolute_path") extraBuildFlags+=("$i" "/mnt$absolute_path")
;; ;;
*) --help)
echo "$0: unknown option \`$i'" exec man nixos-install
exit 1 exit 1
;; ;;
*)
echo "$0: unknown option \`$i'"
exit 1
;;
esac esac
done done
+2 -30
View File
@@ -8,36 +8,8 @@
export NIXOS_CONFIG export NIXOS_CONFIG
usage () { usage () {
echo 1>&2 " exec man nixos-rebuild
Usage: $0 [-v] [-d] [-l] [--xml] OPTION_NAME exit 1
$0 --install
This program allows you to inspect the current value of NixOS
configuration options. It can also generate a basic NixOS
configuration file.
Options:
-i | --install Write a template NixOS configuration file to
${mountPoint:+$mountPoint/}$NIXOS_CONFIG.
-v | --value Display the current value, based on your
configuration.
-d | --description Display the default value, the example and the
description.
-l | --lookup Display where the option is defined and where it
is declared.
--xml Print an XML representation of the result.
Implies -vdl options.
--help Show this message.
Environment variables affecting $0:
\$mountPoint Path to the target file system.
\$NIXOS_CONFIG Path to your configuration file.
"
exit 1;
} }
##################### #####################