Skip to content

Commit

Permalink
reset to current mission when next mission isn't found
Browse files Browse the repository at this point in the history
  • Loading branch information
phyver committed Aug 29, 2024
1 parent f55660e commit c75c2e7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/gsh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ __log_action() {


_gsh_reset() {
local MISSION_NB="$(_gsh_pcm)"
local MISSION_NB="${1:-$(_gsh_pcm)}"
if [ -z "$MISSION_NB" ]
then
local fn_name="${FUNCNAME[0]}"
Expand Down Expand Up @@ -226,11 +226,10 @@ __gsh_start() {
color_echo red "$(eval_gettext "Error: mission \$MISSION_NB doesn't exist!")" >&2
echo
__log_action "$MISSION_NB" "UNKNOWN_MISSION"
gsh reset
gsh reset $(($MISSION_NB-1)) # reset the previous (current) mission
return 1
fi


# re-source static.sh, in case some important directory was removed by accident
[ -f "$MISSION_DIR/static.sh" ] && mission_source "$MISSION_DIR/static.sh"

Expand Down Expand Up @@ -671,8 +670,8 @@ gsh() {
;;
"reset")
export GSH_LAST_ACTION='reset'
__gsh_clean
_gsh_reset
__gsh_clean "$1"
_gsh_reset "$1"
;;
"resetstatic")
_gsh_resetstatic
Expand Down

0 comments on commit c75c2e7

Please sign in to comment.