ソースを参照

Add internal subcommand _ls_subcommands

Alois Mahdal 9 年 前
コミット
6af447c64f
共有1 個のファイルを変更した10 個の追加5 個の削除を含む
  1. 10
    5
      src/bin/saturnin.skel

+ 10
- 5
src/bin/saturnin.skel ファイルの表示

@@ -64,13 +64,17 @@ print_help() {
64 64
     echo ""
65 65
     echo "installed sub-commands:"
66 66
     echo ""
67
+    ls_subcommands | sed -e 's/^/    /'
68
+    return "$FFOO_EXIT_OK"
69
+}
70
+
71
+ls_subcommands() {
67 72
     find "$SATURNIN_LIBEXEC" \
68 73
         -mindepth 1 \
69 74
         -maxdepth 1 \
70 75
         -executable \
71
-      | sed -e 's/.*saturnin-/    /' \
76
+      | sed -e 's/.*saturnin-//' \
72 77
       | sort
73
-    return "$FFOO_EXIT_OK"
74 78
 }
75 79
 
76 80
 version_info() {
@@ -120,7 +124,8 @@ export SATURNIN_SUBCOMMAND="$1"
120 124
 shift
121 125
 
122 126
 case "$SATURNIN_SUBCOMMAND" in
123
-    conf)   inigrep "$@"    ;;
124
-    help)   print_help      ;;
125
-    *)      subcommand "$@" ;;
127
+    conf)               inigrep "$@"    ;;
128
+    help)               print_help      ;;
129
+    _ls_subcommands)    ls_subcommands ;;
130
+    *)                  subcommand "$@" ;;
126 131
 esac