Browse Source

Use pretty.sh's new -w argument

Alois Mahdal 7 years ago
parent
commit
84b990a770
1 changed files with 5 additions and 4 deletions
  1. 5
    4
      src/imapdomo.skel

+ 5
- 4
src/imapdomo.skel View File

11
 
11
 
12
 
12
 
13
 usage() {
13
 usage() {
14
-    mkusage "[options] ACTION" \
14
+    mkusage "$@" "[options] ACTION" \
15
         -o                                                                    \
15
         -o                                                                    \
16
             "-c DIR      change to DIR before doing anything"                 \
16
             "-c DIR      change to DIR before doing anything"                 \
17
             "-d          turn on debugging mode"                              \
17
             "-d          turn on debugging mode"                              \
72
     Debug=false
72
     Debug=false
73
     #shellcheck disable=SC2034
73
     #shellcheck disable=SC2034
74
     while true; do case $1 in
74
     while true; do case $1 in
75
-        -c) CdTo="$2"; shift 2 || usage ;;
75
+        -c) CdTo="$2"; shift 2 || usage -w "missing value to: $1" ;;
76
         -d) Debug=true; PRETTY_DEBUG=true; shift ;;
76
         -d) Debug=true; PRETTY_DEBUG=true; shift ;;
77
         -V|--version-semver) show_semversion ;;
77
         -V|--version-semver) show_semversion ;;
78
         --version) show_version ;;
78
         --version) show_version ;;
79
-        -*) usage ;;
79
+        -*) usage -w "unknown argument: '$1'" ;;
80
         *)  break ;;
80
         *)  break ;;
81
     esac done
81
     esac done
82
     Action="$1"; shift
82
     Action="$1"; shift
83
-    grep -qw "$Action" <<< "newmail|rewind|cleanup|migrate" || usage
83
+    grep -qw "$Action" <<< "newmail|rewind|cleanup|migrate" \
84
+     || usage -w "invalid action: $Action"
84
     cmd=$(mkcmd)
85
     cmd=$(mkcmd)
85
     debug -v cmd
86
     debug -v cmd
86
     bash -n <<<"$cmd" || die
87
     bash -n <<<"$cmd" || die