Procházet zdrojové kódy

Do not show all modules/functions by default (add `-a` option)

Alois Mahdal před 9 roky
rodič
revize
ae5e29ff80
2 změnil soubory, kde provedl 19 přidání a 3 odebrání
  1. 18
    2
      src/bin/shellfu-get.skel
  2. 1
    1
      tests/shellfu_api/TF_RUN

+ 18
- 2
src/bin/shellfu-get.skel Zobrazit soubor

26
     #
26
     #
27
     # List functions from module $1 or all
27
     # List functions from module $1 or all
28
     #
28
     #
29
-    shellfu _list_functions "$modspec"
29
+    local modspec="$1"
30
+    if $show_hidden;
31
+    then
32
+        shellfu _list_functions "$modspec"
33
+    else
34
+        shellfu _list_functions "$modspec" \
35
+          | grep -v ^_ \
36
+          | grep -v \\._
37
+    fi
30
 }
38
 }
31
 
39
 
32
 do_lsmod() {
40
 do_lsmod() {
34
     # List available modules
42
     # List available modules
35
     #
43
     #
36
     local modspec="$1"
44
     local modspec="$1"
37
-    shellfu _list_modules "$modspec"
45
+    if $show_hidden;
46
+    then
47
+        shellfu _list_modules "$modspec"
48
+    else
49
+        shellfu _list_modules "$modspec" \
50
+          | grep -v ^_
51
+    fi
38
 }
52
 }
39
 
53
 
40
 do_path() {
54
 do_path() {
54
 
68
 
55
 main() {
69
 main() {
56
     local action="usage"
70
     local action="usage"
71
+    local show_hidden=false
57
     local include=""
72
     local include=""
58
     while true; do case "$1" in
73
     while true; do case "$1" in
59
         --version)                  do_version;         exit ;;
74
         --version)                  do_version;         exit ;;
60
         --version-semver)           do_semver;          exit ;;
75
         --version-semver)           do_semver;          exit ;;
61
         -I|--include)               include="$2";       shift 2 || usage ;;
76
         -I|--include)               include="$2";       shift 2 || usage ;;
77
+        -a|--all)                   show_hidden=true;   shift ;;
62
         -d|--debug)                 SHELLFU_DEBUG=true; shift ;;
78
         -d|--debug)                 SHELLFU_DEBUG=true; shift ;;
63
         catfun|lsfun|lsmod|path)    action="$1";        shift; break ;;
79
         catfun|lsfun|lsmod|path)    action="$1";        shift; break ;;
64
         *) usage  ;;
80
         *) usage  ;;

+ 1
- 1
tests/shellfu_api/TF_RUN Zobrazit soubor

4
 . "$TF_DIR/include/tools.sh"
4
 . "$TF_DIR/include/tools.sh"
5
 
5
 
6
 shellfu_get_sorted() {
6
 shellfu_get_sorted() {
7
-    shellfu-get "$1" | LC_ALL=C sort
7
+    shellfu-get -a "$1" | LC_ALL=C sort
8
 }
8
 }
9
 
9
 
10
 tf_enum_subtests() {
10
 tf_enum_subtests() {