better configuration help
authorBen Doumenc <bdoumenc@gmail.com>
Mon, 15 Jul 2013 19:49:39 +0000 (21:49 +0200)
committerBen Doumenc <bdoumenc@gmail.com>
Mon, 15 Jul 2013 19:49:39 +0000 (21:49 +0200)
bash/bashject

index 2ae5f96..da02d85 100644 (file)
@@ -18,6 +18,22 @@ BASHJECT_HELP_LIST="bashject list                     # Echoes all projects, sep
 BASHJECT_HELP_CD="bashject cd                       # cd to the current project root path"
 BASHJECT_HELP_HELP="bashject help       [cmd]         # Display global or specific command help"
 
+# Configuration defaults
+
+BASHJECT_PRJ_STORE_DEFAULT=${HOME}/work/.projects
+BASHJECT_PRJ_FILE_DEFAULT=".prj_env"
+BASHJECT_CHANGE_PROMPT_DEFAULT=-1
+BASHJECT_ALIAS_DEFAULT=""
+BASHJECT_TMP_DEFAULT="/tmp/bashject.tmp"
+
+# Configuration values
+
+BASHJECT_PRJ_STORE=${BASHJECT_PRJ_STORE:-${BASHJECT_PRJ_STORE_DEFAULT}}
+BASHJECT_PRJ_FILE=${BASHJECT_PRJ_FILE:-${BASHJECT_PRJ_FILE_DEFAULT}}
+BASHJECT_CHANGE_PROMPT=${BASHJECT_CHANGE_PROMPT:-${BASHJECT_CHANGE_PROMPT_DEFAULT}}
+BASHJECT_ALIAS=${BASHJECT_ALIAS:-${BASHJECT_ALIAS_DEFAULT}}
+BASHJECT_TMP=${BASHJECT_TMP:-${BASHJECT_TMP_DEFAULT}}
+
 read -d '' BASHJECT_HELP << EOF
  Usage:
     - Add a project with 'bashject add name path'
@@ -42,11 +58,11 @@ read -d '' BASHJECT_HELP << EOF
     - ${BASHJECT_HELP_HELP}
 
  Configuration (to override values, define them before sourcing this file)
-    - BASHJECT_PRJ_STORE                # File in which we store all projects configuration (default: ${HOME}/work/.projects)
-    - BASHJECT_PRJ_FILE                 # Name of the project file, created at his root and sourced on 'bashject set' (default: '.prj_env')
-    - BASHJECT_CHANGE_PROMPT            # 1 to change the prompt to '[ $BASHJECT_PRJ_NAME ] PS1' > on 'bashject set' (default: 1)
-    - BASHJECT_ALIAS                    # Name of an alias for bashject to define (i.e: 'bj'), autocompletion will be handled (default: "")
-    - BASHJECT_TMP                      # Temp file used for rename and remove operations
+    - BASHJECT_PRJ_STORE                # File in which we store all projects configuration  (default: '${BASHJECT_PRJ_STORE_DEFAULT}', current: '${BASHJECT_PRJ_STORE}')
+    - BASHJECT_PRJ_FILE                 # Name of the project file, created at his root and sourced on 'bashject set'  (default: '${BASHJECT_PRJ_FILE_DEFAULT}', current: '${BASHJECT_PRJ_FILE}')
+    - BASHJECT_CHANGE_PROMPT            # 1 to change the prompt to '[ BASHJECT_PRJ_NAME ] PS1' > on 'bashject set'  (default: '${BASHJECT_CHANGE_PROMPT_DEFAULT}', current: '${BASHJECT_CHANGE_PROMPT}')
+    - BASHJECT_ALIAS                    # Name of an alias for bashject to define (i.e: 'bj'), autocompletion will be handled (default: '${BASHJECT_ALIAS_DEFAULT}', current: '${BASHJECT_ALIAS}')
+    - BASHJECT_TMP                      # Temp file used for rename and remove operations (default: '${BASHJECT_TMP_DEFAULT}', current: '${BASHJECT_TMP}')
 EOF
 #
 # End of help file
@@ -54,14 +70,6 @@ EOF
 OLD_PS1="$PS1"
 BASHJECT_COMMANDS="add set source remove rename edit path names list cd help"
 
-# Configuration
-
-BASHJECT_PRJ_STORE=${BASHJECT_PRJ_STORE:-${HOME}/work/.projects}
-BASHJECT_PRJ_FILE=${BASHJECT_PRJ_FILE:-".prj_env"}
-BASHJECT_CHANGE_PROMPT=${BASHJECT_CHANGE_PROMPT:-1}
-BASHJECT_ALIAS=${BASHJECT_ALIAS:-""}
-BASHJECT_TMP=${BASHJECT_TMP:-"/tmp/bashject.tmp"}
-
 
 # Real stuff
 function _bj_help() {