aboutsummaryrefslogtreecommitdiff
path: root/q.sh
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2026-03-23 03:16:30 +0000
committeriximeow <me@iximeow.net>2026-04-26 05:19:05 +0000
commit5ef38f263df2cec25d44cb35d1486c2d4d59bc2a (patch)
tree61706a5096440b9f91b0b715eb54ca8afab08979 /q.sh
Diffstat (limited to 'q.sh')
-rw-r--r--q.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/q.sh b/q.sh
new file mode 100644
index 0000000..e763657
--- /dev/null
+++ b/q.sh
@@ -0,0 +1,33 @@
+# snippets to wire up qroject into bash nicely.
+
+enable -f ~/qroject/target/release/libqroject_bash.so q qi qg qd
+
+function qcmdcomp() {
+ # for qg, qg, qi, the first and only argument is
+ # the project name.
+ if [ "$1" = "$3" ]; then
+ COMPREPLY=($(q list "$2"))
+ fi
+}
+
+function qcomp() {
+ case "$3" in
+ add)
+ COMPREPLY=($(compgen -A file "$2"))
+ ;;
+ info | upstream | go | dir | edit | list)
+ COMPREPLY=($(q list "$2"))
+ ;;
+ q)
+ COMPREPLY=(add info upstream go dir edit list)
+ ;;
+ *)
+ COMPREPLY=($(compgen -A file "$2"))
+ ;;
+ esac
+}
+
+complete -F qcomp q
+complete -F qcmdcomp qg
+complete -F qcmdcomp qd
+complete -F qcmdcomp qi