subcommand: Make help text variables private.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 5 Mar 2017 22:03:36 +0000 (23:03 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 17 Apr 2017 00:39:35 +0000 (02:39 +0200)
It is unnecessary to export these as they are never needed in the
environment of subsequently executed commands. In fact, these variables
should be considered private to gsu. The name should thus start with
an underscore.

subcommand

index fe6ec57..71f0614 100644 (file)
@@ -209,7 +209,7 @@ gsu_complete_options()
 
 com_prefs_options='e'
 
-export gsu_prefs_txt="
+_gsu_prefs_txt="
 Print the current preferences.
 
 Usage: prefs [-e]
@@ -272,12 +272,11 @@ complete_prefs()
        gsu_complete_options "$com_prefs_options" "$@"
 }
 
-export gsu_man_txt="
+_gsu_man_txt="
 Print the manual.
 
 Usage: man"
 
-
 com_man()
 {
        local equal_signs="=================================================="
@@ -314,7 +313,7 @@ com_man()
        ret=$GSU_SUCCESS
 }
 
-export gsu_help_txt="
+_gsu_help_txt="
 Print online help.
 
 Usage: help [command]
@@ -322,7 +321,7 @@ Usage: help [command]
 Without arguments, print the list of available commands. Otherwise,
 print the help text for the given command."
 
-export gsu_complete_txt="
+_gsu_complete_txt="
 Command line completion.
 
 Usage: complete [<cword> <word>...]
@@ -347,10 +346,10 @@ com_help()
                gsu_short_msg "### $gsu_name -- $gsu_banner_txt ###"
                _gsu_usage 2>&1
                {
-                       printf "com_help()\n$gsu_help_txt" | head -n 4; echo "--"
-                       printf "com_man()\n$gsu_man_txt" | head -n 4; echo "--"
-                       printf "com_prefs()\n$gsu_prefs_txt" | head -n 4; echo "--"
-                       printf "com_complete()\n$gsu_complete_txt" | head -n 4; echo "--"
+                       printf "com_help()\n$_gsu_help_txt" | head -n 4; echo "--"
+                       printf "com_man()\n$_gsu_man_txt" | head -n 4; echo "--"
+                       printf "com_prefs()\n$_gsu_prefs_txt" | head -n 4; echo "--"
+                       printf "com_complete()\n$_gsu_complete_txt" | head -n 4; echo "--"
                        grep -EA 2 "$ere" $0
                } | grep -v -- '--' \
                        | sed -En "/$ere/"'!d
@@ -379,22 +378,22 @@ com_help()
                return
        fi
        if test "$1" = "help"; then
-               echo "$gsu_help_txt"
+               echo "$_gsu_help_txt"
                ret=$GSU_SUCCESS
                return
        fi
        if test "$1" = "man"; then
-               echo "$gsu_man_txt"
+               echo "$_gsu_man_txt"
                ret=$GSU_SUCCESS
                return
        fi
        if test "$1" = "prefs"; then
-               echo "$gsu_prefs_txt"
+               echo "$_gsu_prefs_txt"
                ret=$GSU_SUCCESS
                return
        fi
        if test "$1" = "complete"; then
-               echo "$gsu_complete_txt"
+               echo "$_gsu_complete_txt"
                ret=$GSU_SUCCESS
                return
        fi