Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Q_… variables support #11

Open
1978ajot opened this issue Aug 27, 2023 · 0 comments
Open

Fix Q_… variables support #11

1978ajot opened this issue Aug 27, 2023 · 0 comments

Comments

@1978ajot
Copy link

q conflicts with https://github.com/harelba/q
Changing the Q_{SET,RUN,UNSET} variables works only partially. There is still a messages that says q is already a command in your \$PATH! : when invoking Q_SET command. Here's my patch:

From 6c0845fbbff8430934d0c488e0ffce4fb8cb40d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andrzej=20Jagie=C5=82o?= <1978ajot@gmail.com>
Date: Sat, 26 Aug 2023 18:06:05 +0200
Subject: [PATCH 1/1] fix: replace hardcoded `q` with `${Q_RUN}`

---
 q.plugin.zsh | 6 +++---
 q.sh         | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/q.plugin.zsh b/q.plugin.zsh
index 195f0c8..af24f5e 100644
--- a/q.plugin.zsh
+++ b/q.plugin.zsh
@@ -55,8 +55,8 @@ q-accept-line() {
         fi
 
         # Check if trying to set to an existing command
-        if type "q${MATCH:1}" > /dev/null; then
-            echo "\nSorry, \"q${MATCH:1}\" is already a commamessagesnd in your \$PATH! :("
+        if type "${Q_RUN}${MATCH:1}" > /dev/null; then
+            echo "\nSorry, \"${Q_RUN}${MATCH:1}\" is already a command in your \$PATH! :("
             BUFFER=""
             zle .accept-line
             return
@@ -68,7 +68,7 @@ q-accept-line() {
 
         # If called without register, show help
         if [[ $REG == "" ]]; then
-            echo "\nq - registers for zsh"
+            echo "\n${Q_RUN} - registers for zsh"
             cat << EOF
 Usage:
     ${Q_RUN}[register] [args]
diff --git a/q.sh b/q.sh
index 918871c..5e5e47b 100644
--- a/q.sh
+++ b/q.sh
@@ -54,8 +54,8 @@ preexec_invoke_exec () {
         fi
 
         # Check if trying to set to an existing command
-        if type "q${BASH_REMATCH:1}" > /dev/null 2>&1; then
-            echo "Sorry, \"q${MATCH:1}\" is already a command in your \$PATH! :("
+        if type "${Q_RUN}${BASH_REMATCH:1}" > /dev/null 2>&1; then
+            echo "Sorry, \"${Q_RUN}${MATCH:1}\" is already a command in your \$PATH! :("
             BUFFER=""
             return 1
         fi
@@ -66,7 +66,7 @@ preexec_invoke_exec () {
 
         # If called without register, show help
         if [[ $REG == "" ]]; then
-            echo "q - registers for zsh"
+            echo "${Q_RUN} - registers for zsh"
             cat << EOF
 Usage:
     $Q_RUN[register] [args]
-- 
2.34.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant