Browse Source

Update and add mmissing docstrings for sfdoc.sh

Alois Mahdal 6 years ago
parent
commit
75320bfa29
1 changed files with 41 additions and 2 deletions
  1. 41
    2
      src/include-bash/sfdoc.sh

+ 41
- 2
src/include-bash/sfdoc.sh View File

2
 
2
 
3
 shellfu import pretty
3
 shellfu import pretty
4
 
4
 
5
+#
6
+# Explore installed Shellfu modules
7
+#
8
+# Modules following Shellfu coding style[1] and installed at one of
9
+# directories listed by $SHELLFU_PATH can be listed and explored using
10
+# functions in this module.
11
+#
12
+#  [1]: https://github.com/AloisMahdal/shellfu/blob/master/notes/style.md
13
+#
14
+# Note that this module exists in order to allow developers implement commands
15
+# similar to sfdoc, which is preferred choice for normal use as it provides
16
+# more feature and better user experience.
17
+#
18
+
5
 #
19
 #
6
 # Show hidden objects (modules, functions, variables)?
20
 # Show hidden objects (modules, functions, variables)?
7
 #
21
 #
22
+# An object (module, function or variable) is considered hidden if its name starts
23
+# with `_` (underscore).  These are ignored by default.  Set this to 'true' to show
24
+# them.
25
+#
8
 SFDOC_SHOW_HIDDEN=${SFDOC_SHOW_HIDDEN:-false}
26
 SFDOC_SHOW_HIDDEN=${SFDOC_SHOW_HIDDEN:-false}
9
 
27
 
10
 sfdoc__export() {
28
 sfdoc__export() {
11
     #
29
     #
12
-    # Export module doc as manpage
30
+    # Export docs of module $2 from file $3 as format $3
31
+    #
32
+    # Usage:
33
+    #
34
+    #     sfdoc__export FMT NAME PATH [ENCODING]
35
+    #
36
+    # Exports docs of module file at PATH, in format FMT, displaying
37
+    # NAME as "natural" name of the module.  Supported FMTs are
38
+    # 'manpage', 'markdown' and 'pod'.  ENCODING is currently used by
39
+    # 'pod' format only and is 'utf8' by default.
13
     #
40
     #
14
     local format=$1             # format to export in
41
     local format=$1             # format to export in
15
     local MName=$2              # name to use in headers
42
     local MName=$2              # name to use in headers
36
     #
63
     #
37
     # List all objects of type $1 in module file $2
64
     # List all objects of type $1 in module file $2
38
     #
65
     #
66
+    # Usage:
67
+    #
68
+    #     sfdoc__ls TYPE PATH
69
+    #
70
+    # TYPE can be 'f' for functions or 'v' for variables.  PATH
71
+    # must be path to a module following Shellfu coding style
72
+    # (see DESCRIPTION section).
73
+    #
39
     local otype=$1
74
     local otype=$1
40
     local mpath=$2
75
     local mpath=$2
41
     case $otype in
76
     case $otype in
56
 
91
 
57
 sfdoc__ls_m() {
92
 sfdoc__ls_m() {
58
     #
93
     #
59
-    # List all modules
94
+    # List all installed modules
95
+    #
96
+    # An installed module is a shell file named ending with '.sh' and
97
+    # placed in one of directories listed in comma-separated list
98
+    # in environment variable $SHELLFU_PATH.
60
     #
99
     #
61
     shellfu _list_mfiles \
100
     shellfu _list_mfiles \
62
       | sed 's|\.sh$||; s|.*/||;' \
101
       | sed 's|\.sh$||; s|.*/||;' \