Browse Source

mftest: usage with error

Scott Lahteine 4 years ago
parent
commit
60607ed18d
1 changed files with 13 additions and 13 deletions
  1. 13
    13
      buildroot/bin/mftest

+ 13
- 13
buildroot/bin/mftest View File

30
   -v --verbose     Extra output for debugging.
30
   -v --verbose     Extra output for debugging.
31
 
31
 
32
 env shortcuts: tree due esp lin lpc|lpc8 lpc9 m128 m256|mega stm|f1 f4 f7 s6 teensy|t31|t32 t35|t36 t40|t41
32
 env shortcuts: tree due esp lin lpc|lpc8 lpc9 m128 m256|mega stm|f1 f4 f7 s6 teensy|t31|t32 t35|t36 t40|t41
33
-
34
 "
33
 "
35
 }
34
 }
36
 
35
 
58
     h) EXIT_USAGE=1 ;;
57
     h) EXIT_USAGE=1 ;;
59
     m) USE_MAKE=1 ; bugout "Using make with Docker..." ;;
58
     m) USE_MAKE=1 ; bugout "Using make with Docker..." ;;
60
     n) case "$OPTARG" in
59
     n) case "$OPTARG" in
61
-         *[!0-9]*) perror "option requires a number" $OFLAG ; EXIT_USAGE=1 ;;
60
+         *[!0-9]*) perror "option requires a number" $OFLAG ; EXIT_USAGE=2 ;;
62
                 *) CHOICE="$OPTARG" ; bugout "Got a number: $CHOICE" ;;
61
                 *) CHOICE="$OPTARG" ; bugout "Got a number: $CHOICE" ;;
63
        esac
62
        esac
64
        ;;
63
        ;;
65
-    r) REBUILD=1         ; bugout "Rebuilding previous..."    ;;
64
+    r) REBUILD=1         ; bugout "Rebuilding previous..." ;;
66
     t) TESTENV="$OPTARG" ; bugout "Got a target: $TESTENV" ;;
65
     t) TESTENV="$OPTARG" ; bugout "Got a target: $TESTENV" ;;
67
-    u) AUTO_BUILD=2      ; bugout "Auto-Upload target..."  ;;
66
+    u) AUTO_BUILD=2      ; bugout "Auto-Upload target..." ;;
68
     v) DEBUG=1           ; bugout "Debug ON" ;;
67
     v) DEBUG=1           ; bugout "Debug ON" ;;
69
-    y) BUILD_YES='Y'     ; bugout "Build will initiate..."    ;;
68
+    y) BUILD_YES='Y'     ; bugout "Build will initiate..." ;;
70
     -) IFS="=" read -r ONAM OVAL <<< "$OPTARG"
69
     -) IFS="=" read -r ONAM OVAL <<< "$OPTARG"
71
        case "$ONAM" in
70
        case "$ONAM" in
72
          help) [[ -z "$OVAL" ]] || perror "option can't take value $OVAL" $ONAM ; EXIT_USAGE=1 ;;
71
          help) [[ -z "$OVAL" ]] || perror "option can't take value $OVAL" $ONAM ; EXIT_USAGE=1 ;;
73
     autobuild) AUTO_BUILD=1 ; bugout "Auto-Build target..."  ;;
72
     autobuild) AUTO_BUILD=1 ; bugout "Auto-Build target..."  ;;
74
    autoupload) AUTO_BUILD=2 ; bugout "Auto-Upload target..." ;;
73
    autoupload) AUTO_BUILD=2 ; bugout "Auto-Upload target..." ;;
75
           env) case "$OVAL" in
74
           env) case "$OVAL" in
76
-                 '') perror "option requires a value" $ONAM ; EXIT_USAGE=1 ;;
75
+                 '') perror "option requires a value" $ONAM ; EXIT_USAGE=2 ;;
77
                   *) TESTENV="$OVAL" ; bugout "Got a target: $TESTENV" ;;
76
                   *) TESTENV="$OVAL" ; bugout "Got a target: $TESTENV" ;;
78
                esac
77
                esac
79
                ;;
78
                ;;
80
           num) case "$OVAL" in
79
           num) case "$OVAL" in
81
                  [0-9]+) CHOICE="$OVAL" ; bugout "Got a number: $CHOICE" ;;
80
                  [0-9]+) CHOICE="$OVAL" ; bugout "Got a number: $CHOICE" ;;
82
-                      *) perror "option requires a value" $ONAM ; EXIT_USAGE=1 ;;
81
+                      *) perror "option requires a value" $ONAM ; EXIT_USAGE=2 ;;
83
                esac
82
                esac
84
                ;;
83
                ;;
85
-      rebuild) REBUILD=1      ; bugout "Rebuilding previous..."    ;;
86
-         make) USE_MAKE=1     ; bugout "Using make with Docker..." ;;
87
-debug|verbose) DEBUG=1        ; bugout "Debug ON" ;;
84
+      rebuild) REBUILD=1  ; bugout "Rebuilding previous..." ;;
85
+         make) USE_MAKE=1 ; bugout "Using make with Docker..." ;;
86
+debug|verbose) DEBUG=1    ; bugout "Debug ON" ;;
88
         build) case "$OVAL" in
87
         build) case "$OVAL" in
89
                  ''|y|yes) BUILD_YES='Y' ;;
88
                  ''|y|yes) BUILD_YES='Y' ;;
90
                      n|no) BUILD_YES='N' ;;
89
                      n|no) BUILD_YES='N' ;;
91
-                        *) perror "option value must be y, n, yes, or no" $ONAM ; EXIT_USAGE=1 ;;
90
+                        *) perror "option value must be y, n, yes, or no" $ONAM ; EXIT_USAGE=2 ;;
92
                esac
91
                esac
93
                bugout "Build will initiate? ($BUILD_YES)"
92
                bugout "Build will initiate? ($BUILD_YES)"
94
                ;;
93
                ;;
95
-            *) perror "Unknown flag" "$OPTARG" ; EXIT_USAGE=1 ;;
94
+            *) perror "Unknown flag" "$OPTARG" ; EXIT_USAGE=2 ;;
96
        esac
95
        esac
97
        ;;
96
        ;;
97
+    *) EXIT_USAGE=2 ;;
98
   esac
98
   esac
99
 done
99
 done
100
 
100
 
101
-((EXIT_USAGE)) && { usage ; exit 1 ; }
101
+((EXIT_USAGE)) && { usage ; let EXIT_USAGE-- ; exit $EXIT_USAGE ; }
102
 
102
 
103
 if ((REBUILD)); then
103
 if ((REBUILD)); then
104
   bugout "Rebuilding previous..."
104
   bugout "Rebuilding previous..."

Loading…
Cancel
Save