Skip to content

Commit

Permalink
hotfix to preserve ctrl+R config during updates
Browse files Browse the repository at this point in the history
config doesn't survive updates but ctrl+R does
  • Loading branch information
curusarn committed Feb 18, 2020
1 parent bbfc036 commit 2136096
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
6 changes: 6 additions & 0 deletions cmd/config/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ func main() {
printBoolNormalized(config.BindArrowKeysZsh)
case "bindcontrolr":
printBoolNormalized(config.BindControlR)
case "port":
fmt.Println(config.Port)
case "sesswatchperiodseconds":
fmt.Println(config.SesswatchPeriodSeconds)
case "sesshistinithistorysize":
fmt.Println(config.SesshistInitHistorySize)
default:
fmt.Println("Error: illegal --key!")
os.Exit(1)
Expand Down
19 changes: 16 additions & 3 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,24 @@ echo "Copying files ..."
cp -f submodules/bash-preexec/bash-preexec.sh ~/.bash-preexec.sh
cp -f submodules/bash-zsh-compat-widgets/bindfunc.sh ~/.resh/bindfunc.sh

cp -f conf/config.toml ~/.config/resh.toml

cp -f scripts/shellrc.sh ~/.resh/shellrc
cp -f scripts/reshctl.sh scripts/widgets.sh scripts/hooks.sh scripts/util.sh ~/.resh/

# hotfix to not overwrite enabled ctrl+R binding in config
bindcontrolr=0
if [ "$(bin/resh-config -key bindcontrolr)" = true ]; then
# control_R binding is enabled
bindcontrolr=1
fi

cp -f conf/config.toml ~/.config/resh.toml

# hotfix part2 (ctrl+R)
if [ "$bindcontrolr" = 1 ]; then
# reenable ctrl+R binding if it was enabled before
bin/resh-control enable ctrl_r_binding_global >/dev/null 2>/dev/null
fi

echo "Generating completions ..."
bin/resh-control completion bash > ~/.resh/bash_completion.d/_reshctl
bin/resh-control completion zsh > ~/.resh/zsh_completion.d/_reshctl
Expand Down Expand Up @@ -172,7 +185,7 @@ __resh_run_daemon



echo "
echo "
##########################################################
# #
# SUCCESS - thank you for trying out this project! #
Expand Down

0 comments on commit 2136096

Please sign in to comment.