Bläddra i källkod

Do not wrap every subcommand

Sub-commands in libexec must use saturnin_wraphook if they want pre/post
hook, or may use saturnin_runhook to run their own hooks as they wish.
Alois Mahdal 9 år sedan
förälder
incheckning
a13a0c9ee1
2 ändrade filer med 9 tillägg och 3 borttagningar
  1. 1
    1
      src/ffoo/saturnin_common.sh
  2. 8
    2
      src/libexec/saturnin-au

+ 1
- 1
src/ffoo/saturnin_common.sh Visa fil

@@ -55,7 +55,7 @@ saturnin_runsc() {
55 55
         saturnin_help
56 56
         return $FFOO_EXIT_USAGE
57 57
     }
58
-    saturnin_wraphook "$lexpath" "$@"
58
+    "$lexpath" "$@"
59 59
 }
60 60
 
61 61
 saturnin_wraphook() {

+ 8
- 2
src/libexec/saturnin-au Visa fil

@@ -4,6 +4,8 @@
4 4
 
5 5
 ffoo import pretty
6 6
 
7
+ffoo import saturnin_common
8
+
7 9
 
8 10
 usage() {
9 11
     mkusage "up"     \
@@ -99,6 +101,10 @@ debug "\$*='$*'"
99 101
 debug -v action
100 102
 
101 103
 case $action in
102
-    up|down|flip|mute|query|unmute) do_$action "$@" ;;
103
-    *)                              usage           ;;
104
+    up|down|flip|mute|query|unmute)
105
+        saturnin_wraphook "do_$action" "$@"
106
+        ;;
107
+    *)
108
+        usage
109
+        ;;
104 110
 esac