Skip to content

Add print_usage function referenced in the script#50

Open
rachael-george wants to merge 1 commit into
HCK-CI:mainfrom
rachael-george:add_print_usage
Open

Add print_usage function referenced in the script#50
rachael-george wants to merge 1 commit into
HCK-CI:mainfrom
rachael-george:add_print_usage

Conversation

@rachael-george

Copy link
Copy Markdown

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.

AutoHCK-Installer]# ./install.sh --help
ERROR:  Unknown option: --help 
./install.sh: line 25: print_usage: command not found

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].

AutoHCK-Installer]# ./install.sh --help
ERROR:  Unknown option: --help 
Usage: install.sh [--silent]

Signed-off-by: rachael-george <rgeorge@redhat.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread install.sh
source "${work_dir}/autohck.sh"

print_usage() {
echo "Usage: install.sh [--silent]" >&2

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
echo "Usage: install.sh [--silent]" >&2
echo "Usage: ${0##*/} [--silent]" >&2

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like nice to have, but not must.

Comment thread install.sh
source "${work_dir}/autohck.sh"

print_usage() {
echo "Usage: install.sh [--silent]" >&2

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like nice to have, but not must.

@kostyanf14 kostyanf14 self-requested a review June 17, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants