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,7 +11,7 @@ IMAPDOMO_HOME="__IMAPDOMO_SHARE__"
11 11
 
12 12
 
13 13
 usage() {
14
-    mkusage "[options] ACTION" \
14
+    mkusage "$@" "[options] ACTION" \
15 15
         -o                                                                    \
16 16
             "-c DIR      change to DIR before doing anything"                 \
17 17
             "-d          turn on debugging mode"                              \
@@ -72,15 +72,16 @@ main() {
72 72
     Debug=false
73 73
     #shellcheck disable=SC2034
74 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 76
         -d) Debug=true; PRETTY_DEBUG=true; shift ;;
77 77
         -V|--version-semver) show_semversion ;;
78 78
         --version) show_version ;;
79
-        -*) usage ;;
79
+        -*) usage -w "unknown argument: '$1'" ;;
80 80
         *)  break ;;
81 81
     esac done
82 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 85
     cmd=$(mkcmd)
85 86
     debug -v cmd
86 87
     bash -n <<<"$cmd" || die