Skip to content

Commit

Permalink
Calling an utility with wrong parameters is an error
Browse files Browse the repository at this point in the history
  • Loading branch information
rdavid committed Aug 5, 2024
1 parent 4130153 commit 0d57867
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 19 deletions.
4 changes: 2 additions & 2 deletions app/bak
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
# Makes incremental backups from the first parameter to the second.
# shellcheck disable=SC1091,SC2034 # File not following, appears unused.
readonly \
BASE_APP_VERSION=0.9.20240208 \
BASE_APP_VERSION=0.9.20240806 \
BASE_MIN_VERSION=0.9.20231212
. base.sh
[ "$#" -eq 2 ] || cya Usage: bak source destination.
[ "$#" -eq 2 ] || die bak: try bak [source directory] [destination directory]
readonly \
DST="$2" \
SRC="$1"
Expand Down
5 changes: 2 additions & 3 deletions app/chowner
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
# and directories started from the seconds argument.
# shellcheck disable=SC1091,SC2034 # File not following, appears unused.
readonly \
BASE_APP_USAGE='Usage: chowner user directory.' \
BASE_APP_VERSION=0.9.20240208 \
BASE_APP_VERSION=0.9.20240806 \
BASE_MIN_VERSION=0.9.20231212
. base.sh
beroot
[ "$#" -eq 2 ] || cya "$BASE_APP_USAGE"
[ "$#" -eq 2 ] || die chowner: try chowner [user directory]
readonly \
DIR="$2" \
USR="$1"
Expand Down
4 changes: 2 additions & 2 deletions app/flactomp3
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# Copyright 2019-2024 David Rabkin
# shellcheck disable=SC1091,SC2034 # File not following, variable unused.
readonly \
BASE_APP_VERSION=0.9.20240208 \
BASE_APP_VERSION=0.9.20240806 \
BASE_MIN_VERSION=0.9.20231212
. base.sh
[ "$#" -eq 1 ] || cya Usage: flactomp3 filename.
[ "$#" -eq 1 ] || die flactomp3: try flactomp3 [file name]
readonly \
SRC="$1" \
TAG="$BASE_WIP"/tags
Expand Down
4 changes: 2 additions & 2 deletions app/ival
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
# Validates image files.
# shellcheck disable=SC1091,SC2034 # File not following, variable unused.
readonly \
BASE_APP_VERSION=0.9.20240208 \
BASE_APP_VERSION=0.9.20240806 \
BASE_MIN_VERSION=0.9.20231212
. base.sh
validate_cmd convert
[ "$#" -eq 1 ] || cya Usage: "$BASE_IAM" directory.
[ "$#" -eq 1 ] || cya ival: try ival [user directory]
readonly DIR="$1"
isreadable "$DIR" || die Directory "$DIR" is not readable.
find "$DIR" -type f \
Expand Down
7 changes: 2 additions & 5 deletions app/pingo
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
# shellcheck disable=SC1091,SC2034 # File not following, appears unused.
set -- "$@" --quiet
readonly \
BASE_APP_VERSION=0.9.20240222 \
BASE_APP_VERSION=0.9.20240806 \
BASE_MIN_VERSION=0.9.20231212
. base.sh
[ $# -ge 1 ] || {
printf 'Usage: pingo [network resource].\n'
cya
}
[ $# -ge 1 ] || die pingo: try pingo [network resource]
{ ping "$1" 2>&1 1>&3 3>&- | tologe; } 3>&1 1>&2 | totsout
4 changes: 2 additions & 2 deletions app/scanner
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Detects if a device with a certain MAC address is in the local network.
# shellcheck disable=SC1091,SC2034 # File not following, variable unused.
readonly \
BASE_APP_VERSION=0.9.20240208 \
BASE_APP_VERSION=0.9.20240806 \
BASE_MIN_VERSION=0.9.20231212
. base.sh
MAXV=10
Expand Down Expand Up @@ -55,7 +55,7 @@ wait() {
# Starting point.
beroot
validate_cmd arp-scan
[ "$#" -eq 1 ] || cya "Usage: $BASE_IAM [MAC-ADDRESS:list]"
[ "$#" -eq 1 ] || die scanner: try scanner [mac address:list]
[ "$1" = list ] && {
$SCAN
cya
Expand Down
2 changes: 1 addition & 1 deletion app/tex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright 2020-2024 David Rabkin
# shellcheck disable=SC1091 # File not following.
. base.sh
[ "$#" -eq 1 ] || cya Usage: "$BASE_IAM" FILENAME.tex
[ "$#" -eq 1 ] || die tex: try tex [file name]
[ -r "$1" ] || die Unable to read from source "$1".
validate_cmd tex dvipdfm
NME=$(basename -- "$1")
Expand Down
4 changes: 2 additions & 2 deletions app/tru
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# shellcheck disable=SC3043 # Uses local variables.
# shellcheck disable=SC1091,SC2034 # File not following, appears unused.
readonly \
BASE_APP_VERSION=0.9.20240208 \
BASE_APP_VERSION=0.9.20240806 \
BASE_MIN_VERSION=0.9.20240104
. base.sh

Expand Down Expand Up @@ -62,7 +62,7 @@ tid() {

validation() {
validate_cmd awk nc tr transmission-remote transmission-show
[ "$#" -eq 3 ] || cya Usage: tru host:port user:pass torrent-file.
[ "$#" -eq 3 ] || die tru: try tru [host:port user:pass torrent-file]

# Single ':' means there is no authentication data.
[ "$2" != : ] && AUT="--auth $2" || AUT=''
Expand Down

0 comments on commit 0d57867

Please sign in to comment.