Skip to content

Commit

Permalink
fix: grep warnings during generating usage documentation
Browse files Browse the repository at this point in the history
to prevent `grep: warning: stray \ before -` and accidental non-zero return
codes
  • Loading branch information
CarstenGrohmann committed Jun 4, 2023
1 parent 28014f9 commit f81f3b3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions govc/usage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ printf "%s\n\`\`\`\n\n" "${common_opts}"

cmds=($(govc -h | sed '1,/^Available commands:$/d'))

opts=($(cut -s -d= -f1 <<<"$common_opts" | xargs -n1 | sed -e 's/^/\\/'))
opts=($(cut -s -d= -f1 <<<"$common_opts" | xargs -n1))
filter=$(printf "|%s=" "${opts[@]}")

printf "<details><summary>Contents</summary>\n\n"
Expand All @@ -61,6 +61,6 @@ printf "\n</details>\n\n"
for cmd in "${cmds[@]}" ; do
printf "## %s\n\n" "$cmd"
printf "\`\`\`\n"
govc "$cmd" -h | egrep -v "${filter:1}"
govc "$cmd" -h | grep -E -v -- "${filter:1}"
printf "\`\`\`\n\n"
done

0 comments on commit f81f3b3

Please sign in to comment.