Skip to content

Commit

Permalink
lang: add bc to the dependency checklist (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
pengyunie authored Dec 3, 2023
1 parent 59ef529 commit caaceff
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lang/x.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ readonly X_JQ="jq"
readonly X_CUT="cut"
readonly X_MD5=$(which md5 || which md5sum)
readonly X_SLEEP="sleep"
readonly X_BC="bc"

readonly X_DATE="date"
readonly X_CAT="cat"
Expand Down Expand Up @@ -61,6 +62,7 @@ function x_enabled() {
_x_check "${X_JQ}" || return 1
_x_check "${X_CUT}" || return 1
_x_check "${X_MD5}" || return 1
_x_check "${X_BC}" || return 1
}

function x_bash_version() {
Expand Down Expand Up @@ -114,6 +116,13 @@ function x_cut_version() {
"no version for ${X_CUT}"
}

function x_bc_version() {
# Print bc version

"${X_BC}" --version 2>&1 | head -n 1 || \
"no version for ${X_BC}"
}

function x_config() {
# Print system configuration.

Expand All @@ -124,4 +133,5 @@ function x_config() {
x_sed_version
x_jq_version
x_cut_version
x_bc_version
}

0 comments on commit caaceff

Please sign in to comment.