added an echo during the regeneration process to let user know it happened.
[feisty_meow.git] / scripts / core / functions.sh
index f1fd1ea1b59c88fa6ab46224efb6dd76f778ed10..9de80ef3e9ca5316ae252c594e10f63a95ea0309 100644 (file)
@@ -14,10 +14,11 @@ if [ $? -eq 0 ]; then
 fi
 
 if [ -z "$skip_all" ]; then
+
   if [ ! -z "$SHELL_DEBUG" ]; then
     echo function definitions begin...
   fi
-  
+
   # a handy little method that can be used for date strings.  it was getting
   # really tiresome how many different ways the script did the date formatting.
   function date_stringer() {
@@ -62,7 +63,7 @@ if [ -z "$skip_all" ]; then
     fi
   }
 
-  # checks the result of the last command that was run, and if it failed,
+  # checks the result of the last command that was run, and if that failed,
   # then this complains and exits from bash.  the function parameters are
   # used as the message to print as a complaint.
   function check_result()
@@ -98,9 +99,6 @@ if [ -z "$skip_all" ]; then
       # we 'type' the file to get rid of the unicode result from wmic.
       cmd $flag type "$tmppid" >$PID_DUMP
       \rm "$tmppid"
-#      local CR='
-#'  # embedded carriage return.
-#      local appropriate_pattern="s/^.*  *\([0-9][0-9]*\)[ $CR]*\$/\1/p"
       local appropriate_pattern="s/^.*  *\([0-9][0-9]*\) *\$/\1/p"
       for i in "${patterns[@]}"; do
         PIDS_SOUGHT+=($(cat $PID_DUMP \
@@ -282,8 +280,15 @@ if [ -z "$skip_all" ]; then
   
   # recreates all the generated files that the feisty meow scripts use.
   function regenerate() {
+    # do the bootstrapping process again.
+    echo "Regenerating Feisty Meow script environment."
     bash $FEISTY_MEOW_SCRIPTS/core/bootstrap_shells.sh
     echo
+    # force a full reload by turning off sentinel variable and alias.
+    unset NECHUNG function_sentinel
+    # reload feisty meow environment in current shell.
+    source ~/feisty_meow/scripts/core/launch_feisty_meow.sh
+    # run nechung oracle to give user a new fortune.
     nechung
   }
 
@@ -339,14 +344,9 @@ if [ -z "$skip_all" ]; then
     echo "copying custom overrides for $user"
     mkdir "$FEISTY_MEOW_GENERATED/custom" 2>/dev/null
     perl "$FEISTY_MEOW_SCRIPTS/text/cpdiff.pl" "$FEISTY_MEOW_DIR/customizing/$user" "$FEISTY_MEOW_GENERATED/custom"
-    # set up any custom script files which we'll add as aliases.
-#    if [ -e "$FEISTY_MEOW_GENERATED/custom/scripts" ]; then
-#      echo removing older custom scripts.
-#      rm -rf "$FEISTY_MEOW_GENERATED/custom/scripts"
-#    fi
     if [ -d "$FEISTY_MEOW_DIR/customizing/$user/scripts" ]; then
       echo "copying custom scripts for $user"
-      cp -R "$FEISTY_MEOW_DIR/customizing/$user/scripts" "$FEISTY_MEOW_GENERATED/custom/"
+      \cp -R "$FEISTY_MEOW_DIR/customizing/$user/scripts" "$FEISTY_MEOW_GENERATED/custom/"
     fi
     echo
     regenerate