diff --git a/setup.sh b/setup.sh index 7a4957f128938447e9758057f9444f3aa67655a3..9b273bfb5c8c0c2806fe3470df6fee5da3fe89d6 100755 --- a/setup.sh +++ b/setup.sh @@ -112,7 +112,7 @@ function manage_plugins() { fi done - function toggle_branch() { + function next_branch() { case ${plugin_branches[$1]} in "") plugin_branches[$1]="master" ;; "master") plugin_branches[$1]="develop" ;; @@ -121,6 +121,15 @@ function manage_plugins() { esac } + function previous_branch() { + case ${plugin_branches[$1]} in + "master") plugin_branches[$1]="" ;; + "develop") plugin_branches[$1]="master" ;; + "") plugin_branches[$1]="develop" ;; + *) >&2; plugin_branches[$1]="" ;; + esac + } + selection=0 exit=false cancel=false @@ -156,10 +165,10 @@ function manage_plugins() { echo "" - echo "[Arrow Up/Down] Select Plugin" - echo "[Space] Toggle branch" - echo "[Enter] Continue" - echo "[Esc] Cancel" + echo "[Arrow Up/Down] Select Plugin" + echo "[Arrow Left/Right] Select branch" + echo "[Enter] Continue" + echo "[Esc] Cancel" SAVEIFS=$IFS IFS='' @@ -173,7 +182,8 @@ function manage_plugins() { IFS=$SAVEIFS case $mode in "") if [ "$escape" == true ]; then cancel=true; fi; exit=true ;; - " ") toggle_branch $selection ;; + "[D") previous_branch $selection ;; + "[C") next_branch $selection ;; "[A") if [ "$selection" -gt "0" ]; then let selection-=1; fi ;; "[B") if [ "$selection" -lt "$num_plugins_minus_one" ]; then let selection+=1; fi ;; *) >&2 ;;