Skip to content

Commit

Permalink
Avoid invalid message for clevis command
Browse files Browse the repository at this point in the history
When specifying 'clevis' command with no parameters,
different options should be printed without message
"Command 'clevis' is invalid"

Fixes latchset#376

Signed-off-by: Sergio Arroutbi <[email protected]>
  • Loading branch information
sarroutbi authored and sergio-correia committed Aug 18, 2022
1 parent e0e92f8 commit 3f879a3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/clevis
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ function findexe() {
}

cmd=clevis
input_commands="$cmd $@"

while [ $# -gt 0 ]; do
[[ "$1" =~ ^- ]] && break
cmd="$cmd-$1"
Expand All @@ -36,8 +38,11 @@ while [ $# -gt 0 ]; do
done

exec >&2
echo
echo "Command '$cmd' is invalid"
if [ "$cmd" != "clevis" ];
then
echo
echo "Command '$input_commands' is invalid"
fi
echo
echo "Usage: clevis COMMAND [OPTIONS]"
echo
Expand Down

0 comments on commit 3f879a3

Please sign in to comment.