diff --git a/docs/usage/cli.en.md b/docs/usage/cli.en.md index 0b700725..3c17df8f 100644 --- a/docs/usage/cli.en.md +++ b/docs/usage/cli.en.md @@ -355,7 +355,7 @@ host stump ## ls-osd -`vitastor-cli osds|ls-osd|osd-ls [-l|--long]` +`vitastor-cli osds|ls-osds|ls-osd|osd-ls [-l|--long]` Show current OSDs as list, optionally with I/O statistics if -l is specified. @@ -508,7 +508,7 @@ the Vitastor authorization model. ## modify-user -`vitastor-cli modify-user --groups ` +`vitastor-cli modify-user|user-modify --groups ` Create or update a user with the given name (matching TLS certificate CN). diff --git a/docs/usage/cli.ru.md b/docs/usage/cli.ru.md index e4787d15..d4f1a911 100644 --- a/docs/usage/cli.ru.md +++ b/docs/usage/cli.ru.md @@ -373,7 +373,7 @@ host stump ## ls-osd -`vitastor-cli osds|ls-osd|osd-ls [-l|--long]` +`vitastor-cli osds|ls-osds|ls-osd|osd-ls [-l|--long]` Показать список OSD, со статистикой ввода-вывода, если установлено -l. @@ -403,7 +403,7 @@ OSD PARENT UP SIZE USED% TAGS WEIGHT BLOCK BITMAP ## pg-list -`vitastor-cli pg-list|pg-ls|list-pg|ls-pg|ls-pgs [OPTIONS] [state1+state2] [^state3] [...]` +`vitastor-cli pg-list|pg-ls|list-pg|ls-pg|ls-pgs|pgs [OPTIONS] [state1+state2] [^state3] [...]` Вывести список PG с состояними, удовлетворяющими любому из переданных фильтров (^ или ! в начале фильтра означает отрицание). Опции: @@ -527,7 +527,7 @@ OSD PARENT UP SIZE USED% TAGS WEIGHT BLOCK BITMAP ## modify-user -`vitastor-cli modify-user --groups ` +`vitastor-cli modify-user|user-modify --groups ` Создать или изменить пользователя с указанным именем (совпадающим с CN TLS-сертификата). diff --git a/src/cmd/cli.cpp b/src/cmd/cli.cpp index 28ba05af..71d7616c 100644 --- a/src/cmd/cli.cpp +++ b/src/cmd/cli.cpp @@ -179,7 +179,7 @@ static const char* help_text = "vitastor-cli osd-tree [-l|--long]\n" " Show current OSD tree, optionally with I/O statistics if -l is specified.\n" "\n" - "vitastor-cli osds|ls-osd|osd-ls [-l|--long]\n" + "vitastor-cli osds|ls-osds|ls-osd|osd-ls [-l|--long]\n" " Show current OSDs as list, optionally with I/O statistics if -l is specified.\n" "\n" "vitastor-cli modify-osd [--tags tag1,tag2,...] [--reweight ] [--noout true/false] \n" @@ -253,7 +253,7 @@ static const char* help_text = "vitastor-cli ls-users|user-ls|ls-user|list-users [ ...]\n" " List users (only with specified names if passed).\n" "\n" - "vitastor-cli modify-user --type --groups group1,group2,... \n" + "vitastor-cli modify-user|user-modify --type --groups group1,group2,... \n" " Create or update user permissions. User names match CN of their certificates.\n" " --type TYPE Set user type: client or admin. Default is client.\n" " --groups GROUPS Set user's groups.\n" diff --git a/tests/run_tests.sh b/tests/run_tests.sh index d72fcf78..1d652e57 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -95,6 +95,8 @@ OLD=1 SCHEME=ec IMMEDIATE_COMMIT=1 ./test_rebalance_verify.sh ./test_dd.sh +./test_cli_help.sh + ./test_root_node.sh ./test_switch_primary.sh diff --git a/tests/test_cli_help.sh b/tests/test_cli_help.sh new file mode 100755 index 00000000..099c2c1b --- /dev/null +++ b/tests/test_cli_help.sh @@ -0,0 +1,14 @@ +#!/bin/bash -ex + +# Test that vitastor-cli --help knows every command name and alias the CLI accepts + +. `dirname $0`/common.sh + +for cmd in $(grep -o 'cmd\[0\] == "[^"]*"' src/cmd/cli.cpp | sed 's/.*== "//; s/"$//'); do + build/src/cmd/vitastor-cli --help $cmd > ./testdata/help.txt 2>&1 || true + if grep -q '^Unknown command' ./testdata/help.txt; then + format_error "vitastor-cli --help $cmd does not know the command" + fi +done + +format_green OK