Procházet zdrojové kódy

Update and improve usage-related docstrings

Alois Mahdal před 7 roky
rodič
revize
7edc8c7bc0
1 změnil soubory, kde provedl 8 přidání a 8 odebrání
  1. 8
    8
      src/include-bash/pretty.sh

+ 8
- 8
src/include-bash/pretty.sh Zobrazit soubor

@@ -37,7 +37,13 @@ PRETTY_VERBOSE=${PRETTY_VERBOSE:-false}
37 37
 PRETTY=${PRETTY:-plain}
38 38
 
39 39
 #
40
-# Usage mode -- set to 'subcommand' to remove first dash
40
+# Usage display mode
41
+#
42
+# How to determine program name for purposes of usage messages.
43
+#
44
+# If empty, use basename of "$0".  Set to 'subcommand' to remove first
45
+# dash (so that `path/to/foo-bar becomes `foo bar` which may make more
46
+# sense in meta-command scenrarios).  Set to self=NAME to force NAME.
41 47
 #
42 48
 PRETTY_USAGE=${PRETTY_USAGE:-}
43 49
 
@@ -131,12 +137,6 @@ mkusage() {
131 137
     #
132 138
     # Use "--" to delimit end of arguments processed by mkusage.
133 139
     #
134
-    # Setting PRETTY_USAGE to 'subcommand' has effect that
135
-    # in each call, first hyphen in the script's "own" name is
136
-    # replaced by space; this is used for git-like sub-commands,
137
-    # where the actual binary name is e.g. "git-add" for
138
-    # "git add".
139
-    #
140 140
     # Recommended usage is to define usage() in your script and
141 141
     # use this in its body.  That way you only need to define
142 142
     # usage patterns once and skip to them from any place where
@@ -456,7 +456,7 @@ _pretty__echo_usage() {
456 456
     #
457 457
     #  *  usage mode (`-u`, active by default), prints
458 458
     #     "usage:" header, indents next arguments and prefixes
459
-    #     them with name of the script.
459
+    #     them with name of the script.  See also $PRETTY_USAGE.
460 460
     #
461 461
     #     A special case of usage mode is when only single
462 462
     #     argument is passed to this function; then instead