mirror of
https://abf.rosa.ru/djam/auto-krokodil.git
synced 2025-02-24 02:52:59 +00:00
cli: add help
This commit is contained in:
parent
378bff0d54
commit
159175e30a
1 changed files with 23 additions and 1 deletions
24
kroko-cli.sh
24
kroko-cli.sh
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue