Fix quoted/escaped file path handling in _hledger()

When reading hledger (rules-)file from COMP_WORDS we need to unescape it
first. For once compgen is doing exactly what we need :)
This commit is contained in:
Vladimir Zhelezov 2020-12-07 07:36:26 +01:00
parent 72b737a42f
commit d98ff3b93d
2 changed files with 6 additions and 0 deletions

View File

@ -281,6 +281,8 @@ _hledger() {
else
hledgerFile=${COMP_WORDS[i+1]}
fi
# Pass it through compgen to unescape it
hledgerFile=$(compgen -W "$hledgerFile")
;;
--rules-file)
if [[ ${COMP_WORDS[i+1]} == '=' ]]; then
@ -288,6 +290,7 @@ _hledger() {
else
hledgerRulesFile=${COMP_WORDS[i+1]}
fi
hledgerRulesFile=$(compgen -W "$hledgerRulesFile")
;;
esac
done

View File

@ -281,6 +281,8 @@ _hledger() {
else
hledgerFile=${COMP_WORDS[i+1]}
fi
# Pass it through compgen to unescape it
hledgerFile=$(compgen -W "$hledgerFile")
;;
--rules-file)
if [[ ${COMP_WORDS[i+1]} == '=' ]]; then
@ -288,6 +290,7 @@ _hledger() {
else
hledgerRulesFile=${COMP_WORDS[i+1]}
fi
hledgerRulesFile=$(compgen -W "$hledgerRulesFile")
;;
esac
done