mirror of
https://github.com/pyenv/pyenv.git
synced 2024-12-12 07:03:56 -05:00
help: have --usage
always print a usage line
This commit is contained in:
parent
af9201ea1e
commit
592fe6a087
2 changed files with 17 additions and 1 deletions
|
@ -144,7 +144,11 @@ print_usage() {
|
||||||
local command="$1"
|
local command="$1"
|
||||||
local summary usage help
|
local summary usage help
|
||||||
eval "$(documentation_for "$command")"
|
eval "$(documentation_for "$command")"
|
||||||
[ -z "$usage" ] || echo "$usage"
|
if [ -n "$usage" ]; then
|
||||||
|
echo "$usage"
|
||||||
|
else
|
||||||
|
echo "Usage: rbenv ${command}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
unset usage
|
unset usage
|
||||||
|
|
|
@ -71,6 +71,18 @@ SH
|
||||||
assert_success "Usage: rbenv hello <world>"
|
assert_success "Usage: rbenv hello <world>"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "empty usage section" {
|
||||||
|
mkdir -p "${RBENV_TEST_DIR}/bin"
|
||||||
|
cat > "${RBENV_TEST_DIR}/bin/rbenv-hello" <<SH
|
||||||
|
#!shebang
|
||||||
|
# Summary: Says "hello" to you, from rbenv
|
||||||
|
echo hello
|
||||||
|
SH
|
||||||
|
|
||||||
|
run rbenv-help --usage hello
|
||||||
|
assert_success "Usage: rbenv hello"
|
||||||
|
}
|
||||||
|
|
||||||
@test "multiline usage section" {
|
@test "multiline usage section" {
|
||||||
mkdir -p "${RBENV_TEST_DIR}/bin"
|
mkdir -p "${RBENV_TEST_DIR}/bin"
|
||||||
cat > "${RBENV_TEST_DIR}/bin/rbenv-hello" <<SH
|
cat > "${RBENV_TEST_DIR}/bin/rbenv-hello" <<SH
|
||||||
|
|
Loading…
Reference in a new issue