Add print_usage function referenced in the script#50
Conversation
Signed-off-by: rachael-george <rgeorge@redhat.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a print_usage function in install.sh to display usage instructions. The reviewer suggests dynamically resolving the script name using ${0##*/} instead of hardcoding install.sh to ensure the usage message remains accurate if the script is renamed.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| source "${work_dir}/autohck.sh" | ||
|
|
||
| print_usage() { | ||
| echo "Usage: install.sh [--silent]" >&2 |
There was a problem hiding this comment.
Instead of hardcoding the script name install.sh, it is a best practice in Bash to use ${0##*/}. This ensures that if the script is renamed or executed via a different path, the usage message will dynamically display the correct script name.
| echo "Usage: install.sh [--silent]" >&2 | |
| echo "Usage: ${0##*/} [--silent]" >&2 |
There was a problem hiding this comment.
Sounds like nice to have, but not must.
| source "${work_dir}/autohck.sh" | ||
|
|
||
| print_usage() { | ||
| echo "Usage: install.sh [--silent]" >&2 |
There was a problem hiding this comment.
Sounds like nice to have, but not must.
The argument parser calls print_usage on invalid options, but the function did not exist. That would cause a runtime error (print_usage: command not found) instead of a clean error message.
This PR:
Adds the missing print_usage() helper to
install.sh, which was already called when an unknown CLI flag is passed but was never defined.Prints a short usage line to stderr:
Usage: install.sh [--silent].