cli: add help

This commit is contained in:
Mikhail Novosyolov 2022-10-16 00:39:15 +03:00
parent 378bff0d54
commit 159175e30a

View file

@ -23,6 +23,20 @@ _echo_err(){
echo "$@" 1>&2
}
_echo_help() {
echo "
Usage: $0 [ get-gpus | best-driver | autoinstall ]
get-gpus — list NVIDIA GPUs
best-driver — print which NVIDIA driver best fits this system
autoinstall — automatically install the best NVIDIA driver for this system
help — print this help
Example:
$0 autoinstall
(run from root)
"
}
# shellcheck disable=SC2120
_mktemp(){
mktemp --tmpdir="$KROKO_TMPDIR" "$@"
@ -320,7 +334,7 @@ _cli_autoinstall(){
}
_main(){
case "$1" in
case "${1:-}" in
"get-gpus" )
_cli_get_gpus
;;
@ -330,6 +344,14 @@ _main(){
"autoinstall" )
_cli_autoinstall
;;
"help" | "--help" | "-h" )
_echo_help
return 0
;;
* )
_echo_help
return 1
;;
esac
}