Selaa lähdekoodia

Add --which to help with debugging path problems

Alois Mahdal 6 vuotta sitten
vanhempi
commit
db15686545
1 muutettua tiedostoa jossa 8 lisäystä ja 2 poistoa
  1. 8
    2
      src/bin/sfdoc

+ 8
- 2
src/bin/sfdoc Näytä tiedosto

@@ -12,6 +12,7 @@ usage() {
12 12
         "[options] MODULE"                                              \
13 13
         "[options] --ls [MODULE]"                                       \
14 14
         "[options] --ls{var|fun} MODULE"                                \
15
+        "[options] --which"                                             \
15 16
         "[options] --lsmod"                                             \
16 17
         "[options] --export FMT MODULE"                                 \
17 18
         -c                                                              \
@@ -20,6 +21,7 @@ usage() {
20 21
             "-L, --lsmod        show list of modules"                   \
21 22
             " --lsfun MODULE    show list of functions in MODULE"       \
22 23
             " --lsvar MODULE    show list of variables in MODULE"       \
24
+            " --which MODULE    show path to MODULE file"               \
23 25
             "-e, --export FMT MODULE   export MODULE documentation in"  \
24 26
             "                   format FMT: 'markdown', 'manpage' and"  \
25 27
             "                   'pod' are supported"                    \
@@ -75,6 +77,7 @@ main() {
75 77
         -I|--include)   SHELLFU_PATH="$2:$SHELLFU_PATH"; shift 2 || usage ;;
76 78
         -l|--ls)        action=lsx;                 shift; break ;;
77 79
         -L|--lsmod)     action=lsm;                 shift; break ;;
80
+        --which)        action=wch;                 shift; break ;;
78 81
         -o|--only-from) SHELLFU_PATH="$2"; SHELLFU_INCLUDE=""; shift 2 || usage ;;
79 82
         --lsvar)        action=lsv;                 shift; break ;;
80 83
         --lsfun)        action=lsf;                 shift; break ;;
@@ -88,11 +91,11 @@ main() {
88 91
     debug -v SHELLFU_INCLUDE SHELLFU_PATH SFDOC_SHOW_HIDDEN
89 92
     debug -v action format module RealModuleName
90 93
     case $action:$module in
91
-        lsx:*|lsm:*)    true ;;
94
+        lsx:*|lsm:*|wch:*) true ;;
92 95
         *:)             usage ;;
93 96
     esac
94 97
     case $action in
95
-        lsm)    : ;;
98
+        lsm|wch) : ;;
96 99
         *)      mpath=$(select_mfile "$module") || die ;;
97 100
     esac
98 101
     case $action in
@@ -128,6 +131,9 @@ main() {
128 131
             sfdoc__export manpage "${RealModuleName:-$module}" "$mpath" \
129 132
               | man -l -
130 133
             ;;
134
+        wch)
135
+            select_mfile "$module"
136
+            ;;
131 137
     esac
132 138
 }
133 139