|
@@ -2,14 +2,41 @@
|
2
|
2
|
|
3
|
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
|
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
|
26
|
SFDOC_SHOW_HIDDEN=${SFDOC_SHOW_HIDDEN:-false}
|
9
|
27
|
|
10
|
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
|
41
|
local format=$1 # format to export in
|
15
|
42
|
local MName=$2 # name to use in headers
|
|
@@ -36,6 +63,14 @@ sfdoc__ls() {
|
36
|
63
|
#
|
37
|
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
|
74
|
local otype=$1
|
40
|
75
|
local mpath=$2
|
41
|
76
|
case $otype in
|
|
@@ -56,7 +91,11 @@ sfdoc__ls() {
|
56
|
91
|
|
57
|
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
|
100
|
shellfu _list_mfiles \
|
62
|
101
|
| sed 's|\.sh$||; s|.*/||;' \
|