From 909aba4d0aa4a3fb14208267d89451ac49fc8697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Reegn?= Date: Fri, 12 Nov 2021 18:02:14 +0100 Subject: [PATCH] zsh alias support --- jq.plugin.zsh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/jq.plugin.zsh b/jq.plugin.zsh index 55dbfef..932a914 100755 --- a/jq.plugin.zsh +++ b/jq.plugin.zsh @@ -1,8 +1,16 @@ if [[ -o zle ]]; then __get_query() { - jq-repl -- ${LBUFFER} - return $? + if [ "${JQ_ZSH_PLUGIN_EXPAND_ALIASES:-0}" -eq 1 ]; then + unset 'functions[_jq-plugin-expand]' + functions[_jq-plugin-expand]=${LBUFFER} + (($+functions[_jq-plugin-expand])) && COMMAND=${functions[_jq-plugin-expand]#$'\t'} + jq-repl -- ${COMMAND} + return $? + else + jq-repl -- ${LBUFFER} + return $? + fi } jq-complete() {