Dont rely on declare -g existing in bash

This commit is contained in:
Kovid Goyal
2022-01-14 18:21:21 +05:30
parent 72745dfb62
commit 9dd5410433

View File

@@ -1,9 +1,12 @@
#!/bin/bash
# this is defined outside _ksi_main to make it global without using declare -g
# which is not available on older bash
declare -A _ksi_prompt=( [cursor]='y' [title]='y' [mark]='y' [complete]='y' [ps0]='' [ps1]='' [ps2]='' )
_ksi_main() {
if [[ $- != *i* ]] ; then return; fi # check in interactive mode
if [[ -z "$KITTY_SHELL_INTEGRATION" ]]; then return; fi
declare -g -A _ksi_prompt=( [cursor]='y' [title]='y' [mark]='y' [complete]='y' [ps0]='' [ps1]='' [ps2]='' )
set -f
for i in ${KITTY_SHELL_INTEGRATION[@]}; do
set +f