Skip to content

Commit

Permalink
move err func to the top
Browse files Browse the repository at this point in the history
  • Loading branch information
Akshat0694 committed Feb 4, 2024
1 parent bc7db05 commit 7440da9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions sg-cli
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ readonly API_URL="${BASE_URL}/api/v1"
readonly DASHBOARD_URL="${SG_DASHBOARD_URL:-"https://app.stackguardian.io/orchestrator"}"
readonly API_TOKEN="${SG_API_TOKEN}"

err() { #{{{
printf "%s ${C_RED_BOLD}[ERROR] ${C_RESET}%s" "$(log_date)" "$*" >&2
printf "\n\n(Try ${C_BOLD}%s --help${C_RESET} for more information.)\n" "$(basename "${0}")"
}
#}}}

# check if jq command is installed
if ! type jq >/dev/null 2>&1; then
err "jq command is required"
Expand Down Expand Up @@ -50,12 +56,6 @@ json_print() { #{{{
}
#}}}

err() { #{{{
printf "%s ${C_RED_BOLD}[ERROR] ${C_RESET}%s" "$(log_date)" "$*" >&2
printf "\n\n(Try ${C_BOLD}%s --help${C_RESET} for more information.)\n" "$(basename "${0}")"
}
#}}}

warn() { #{{{
printf "%s ${C_YELLOW_BOLD}[WARNING] ${C_RESET}%s\n" "$(log_date)" "$*"
}
Expand Down

0 comments on commit 7440da9

Please sign in to comment.