Browse Source

Do not repeat verbose/debug mode handling

Scripts are supposed to be launched as sub-commands of /bin/saturnin, which
can easily handle this for them.

Or you can still set these variables by hand.  (i.e. `FFOO_DEBUG=true saturnin-www`)
Alois Mahdal 10 years ago
parent
commit
608bd7d203
5 changed files with 4 additions and 35 deletions
  1. 0
    7
      bin/saturnin-ini.skel
  2. 1
    6
      bin/saturnin-ln
  3. 0
    3
      bin/saturnin-push
  4. 3
    13
      bin/saturnin-revert
  5. 0
    6
      bin/saturnin-watch

+ 0
- 7
bin/saturnin-ini.skel View File

5
 
5
 
6
 ffoo import ini
6
 ffoo import ini
7
 
7
 
8
-while true; do case $1 in
9
-    -d|--debug)     FFOO_DEBUG=true; shift      ;;
10
-    -v|--verbose)   FFOO_VERBOSE=true; shift    ;;
11
-    --)             shift; break                ;;
12
-    *)              break;                      ;;
13
-esac done
14
-
15
 debug "\$*=$*"
8
 debug "\$*=$*"
16
 
9
 
17
 iniread "$@"
10
 iniread "$@"

+ 1
- 6
bin/saturnin-ln View File

21
 "
21
 "
22
 
22
 
23
 usage() {
23
 usage() {
24
-    local u
25
-    u="[-d|--debug] [-f|--force] [-v|--verbose]"
26
-    u="$u [-t|--target TARGET] SOURCE [NAME]"
27
-    usage_is "$u"
24
+    usage_is "[-f|--force] [-t|--target TARGET] SOURCE [NAME]"
28
 }
25
 }
29
 
26
 
30
 link() {
27
 link() {
45
 }
42
 }
46
 
43
 
47
 while true; do case $1 in
44
 while true; do case $1 in
48
-    -d|--debug)         FFOO_DEBUG=true;    shift   ;;
49
     -f|--force)         FORCE=true;         shift   ;;
45
     -f|--force)         FORCE=true;         shift   ;;
50
-    -v|--verbose)       FFOO_VERBOSE=true;  shift   ;;
51
     -t|--target)        target=$2           shift 2 ;;
46
     -t|--target)        target=$2           shift 2 ;;
52
     "")                 usage                       ;;
47
     "")                 usage                       ;;
53
     *)                  src=$1; name=$2;    break   ;;
48
     *)                  src=$1; name=$2;    break   ;;

+ 0
- 3
bin/saturnin-push View File

8
 ORDER="$(saturnin-ini -p push.options.order)"
8
 ORDER="$(saturnin-ini -p push.options.order)"
9
 
9
 
10
 while true; do case $1 in
10
 while true; do case $1 in
11
-    -d|--debug)     FFOO_DEBUG=true;    shift;      ;;
12
-    -v|--verbose)   FFOO_VERBOSE=true;  shift;      ;;
13
-    -q|--quiet)     FFOO_VERBOSE=false; shift;      ;;
14
     -o|--order)     ORDER=$2;           shift 2;    ;;
11
     -o|--order)     ORDER=$2;           shift 2;    ;;
15
     -h|--help)      usage;                          ;;
12
     -h|--help)      usage;                          ;;
16
     "")             break                           ;;
13
     "")             break                           ;;

+ 3
- 13
bin/saturnin-revert View File

5
 ffoo import core
5
 ffoo import core
6
 ffoo import recon
6
 ffoo import recon
7
 
7
 
8
+FFOO_VERBOSE=${FFOO_VERBOSE:-true}
9
+
8
 usage() {
10
 usage() {
9
-    usage_is "[-d|--debug] [-v|--verbose] [--dry-run] [-c|--connection] domain [snapshot]"
11
+    usage_is "[--dry-run] [-c|--connection] domain [snapshot]"
10
 }
12
 }
11
 
13
 
12
 FFOO_DRY_RUN=false
14
 FFOO_DRY_RUN=false
18
             connection=$2
20
             connection=$2
19
             shift 2
21
             shift 2
20
             ;;
22
             ;;
21
-        -d|--debug)
22
-            FFOO_DEBUG=true
23
-            shift 1
24
-            ;;
25
-        -q|--quiet)
26
-            FFOO_VERBOSE=false
27
-            shift 1
28
-            ;;
29
-        -v|--verbose)
30
-            FFOO_VERBOSE=true
31
-            shift 1
32
-            ;;
33
         --dry-run)
23
         --dry-run)
34
             FFOO_DRY_RUN=true
24
             FFOO_DRY_RUN=true
35
             shift 1
25
             shift 1

+ 0
- 6
bin/saturnin-watch View File

5
 ffoo import core
5
 ffoo import core
6
 ffoo import recon
6
 ffoo import recon
7
 
7
 
8
-FFOO_DEBUG=false
9
-
10
 interval=2
8
 interval=2
11
 
9
 
12
 report_limits() {
10
 report_limits() {
43
             interval=$2
41
             interval=$2
44
             shift 2
42
             shift 2
45
             ;;
43
             ;;
46
-        -d|--debug)
47
-            FFOO_DEBUG=true
48
-            shift 1
49
-            ;;
50
         -r|--regexes)
44
         -r|--regexes)
51
             regexes=$2
45
             regexes=$2
52
             shift 2
46
             shift 2