Giter Site home page Giter Site logo

q's Issues

Fix `Q_โ€ฆ` variables support

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?= <[email protected]>
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

question about the design

Hi, good idea but why would you ever install a trap for something that doesn't need it? I am probably missing a point, could you please enlighten me?

Everything broken if using this

I really like this script. But if using it in Ubuntu 14.04 bash strange things happens.

For example if executing simple things like

echo "foo" | grep bar

The grep command does not finish but is somewhat in background. This happens on multiple different configuration of 2 other colleges of mine. We just deinstalled it for now ;(

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.