diff options
| author | filip <“filip.rabiega@gmail.com”> | 2026-01-21 23:42:15 +0100 |
|---|---|---|
| committer | filip <“filip.rabiega@gmail.com”> | 2026-01-21 23:42:15 +0100 |
| commit | 17df35dc088c9b1b159c2b78d8330fa9cc9a672a (patch) | |
| tree | 052205953f7f11a9ea847a9b4d238f6acdbc25b8 /cht.sh | |
| parent | d127601c83c1a30063b76eb89bf0d9a32ed435b9 (diff) | |
| download | chadscripts-17df35dc088c9b1b159c2b78d8330fa9cc9a672a.tar.gz chadscripts-17df35dc088c9b1b159c2b78d8330fa9cc9a672a.tar.bz2 chadscripts-17df35dc088c9b1b159c2b78d8330fa9cc9a672a.zip | |
reformat most scripts
Diffstat (limited to 'cht.sh')
| -rwxr-xr-x | cht.sh | 74 |
1 files changed, 37 insertions, 37 deletions
@@ -48,8 +48,8 @@ export LESSSECURE=1 STEALTH_MAX_SELECTION_LENGTH=5 case "$(uname -s)" in - Darwin) is_macos=yes ;; - *) is_macos=no ;; +Darwin) is_macos=yes ;; +*) is_macos=no ;; esac # for KSH93 @@ -122,10 +122,10 @@ EOF local dependencies=(python git virtualenv) for dep in "${dependencies[@]}"; do command -v "$dep" >/dev/null || - { - echo "DEPENDENCY: \"$dep\" is needed to install cheat.sh in the standalone mode" >&2 - _exit_code=1 - } + { + echo "DEPENDENCY: \"$dep\" is needed to install cheat.sh in the standalone mode" >&2 + _exit_code=1 + } done [ "$_exit_code" -ne 0 ] && return "$_exit_code" @@ -136,8 +136,8 @@ EOF [ -n "$_installdir" ] && installdir=$_installdir if [ "$installdir" = y ] || - [ "$installdir" = Y ] || - [ "$(echo "$installdir" | tr "[:upper:]" "[:lower:]")" = yes ]; then + [ "$installdir" = Y ] || + [ "$(echo "$installdir" | tr "[:upper:]" "[:lower:]")" = yes ]; then echo Please enter the directory name echo If it was the directory name already, please prepend it with \"./\": "./$installdir" else @@ -201,7 +201,7 @@ EOF _say_what_i_do Creating virtual environment virtualenv "${virtualenv_python3_option[@]}" ve || - fatal "Could not create virtual environment with 'virtualenv ve'" + fatal "Could not create virtual environment with 'virtualenv ve'" export CHEATSH_PATH_WORKDIR=$PWD @@ -214,15 +214,15 @@ EOF _say_what_i_do Installing python requirements into the virtual environment ve/bin/"$pip" install -r requirements.txt >"$LOG" || - { - - echo "ERROR:" - echo "---" - tail -n 10 "$LOG" - echo "---" - echo "See $LOG for more" - fatal Could not install python dependencies into the virtual environment - } + { + + echo "ERROR:" + echo "---" + tail -n 10 "$LOG" + echo "---" + echo "See $LOG for more" + fatal Could not install python dependencies into the virtual environment + } echo "$(ve/bin/"$pip" freeze | wc -l) dependencies were successfully installed" _say_what_i_do Fetching the upstream cheat sheets repositories @@ -324,8 +324,8 @@ get_query_options() { local query="$*" if [ -n "$CHTSH_QUERY_OPTIONS" ]; then case $query in - *\?*) query="$query&${CHTSH_QUERY_OPTIONS}" ;; - *) query="$query?${CHTSH_QUERY_OPTIONS}" ;; + *\?*) query="$query&${CHTSH_QUERY_OPTIONS}" ;; + *) query="$query?${CHTSH_QUERY_OPTIONS}" ;; esac fi printf "%s" "$query" @@ -420,12 +420,12 @@ elif [ "$(uname -s)" = OpenBSD ] && [ -x /usr/bin/ftp ]; then local opt args="-o -" while getopts "b:s" opt; do case $opt in - b) args="$args -c $OPTARG" ;; - s) args="$args -M -V" ;; - *) - echo "internal error: unsupported cURL option '$opt'" >&2 - exit 1 - ;; + b) args="$args -c $OPTARG" ;; + s) args="$args -M -V" ;; + *) + echo "internal error: unsupported cURL option '$opt'" >&2 + exit 1 + ;; esac done shift $((OPTIND - 1)) @@ -508,8 +508,8 @@ else valid_sections=$(get_list_of_sections) valid=no for q in $valid_sections; do [ "$q" = "$new_section/" ] && { - valid=yes - break + valid=yes + break }; done if [ "$valid" = yes ]; then @@ -561,17 +561,17 @@ cmd_cd() { valid_sections=$(get_list_of_sections) valid=no for q in $valid_sections; do [ "$q" = "$new_section/" ] && { - valid=yes - break + valid=yes + break }; done if [ "$valid" = no ]; then echo "Invalid section: $new_section" echo "Valid sections:" echo "$valid_sections" | - xargs printf "%-10s\n" | - tr ' ' . | - xargs -n 10 | - sed 's/\./ /g; s/^/ /' + xargs printf "%-10s\n" | + tr ' ' . | + xargs -n 10 | + sed 's/\./ /g; s/^/ /' else section="$new_section" fi @@ -803,7 +803,7 @@ while true; do cmd_name=${input%% *} cmd_args=${input#* } case $cmd_name in - "") continue ;; # skip empty input lines + "") continue ;; # skip empty input lines '?' | h | help) cmd_name=help ;; hush) cmd_name=hush ;; cd) cmd_name="cd" ;; @@ -818,6 +818,6 @@ while true; do cmd_name="query" cmd_args="$input" ;; -esac -"cmd_$cmd_name" $cmd_args + esac + "cmd_$cmd_name" $cmd_args done |
