Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@ print_err() {
printf "\n${RED}%s${CLEAR}\n" "$*" >&2
}

# Function: check_cmd
# Description: Checks if a specified command is available in the system.
# Usage: check_cmd "command_name"
check_cmd() {
command_name="$1"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

WARNING: Missing input validation - check_cmd called without arguments may incorrectly return success

If check_cmd is invoked without an argument, command_name="" and command -v "" returns 0 (success) in POSIX shells, incorrectly indicating the command exists. Add a check for empty input.

Suggested change
command_name="$1"
command_name="${1:?Missing command name argument}"

Reply with @kilocode-bot fix it to have Kilo Code address this issue.


if ! command -v "${command_name}" >/dev/null 2>&1; then
return 1
fi

return 0
}

# Function: check_command
# Description: Checks if a specified command is available in the system.
# Prints a message indicating whether the command is installed.
Expand Down
Loading