aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2016-07-21 17:30:37 -0400
committerTeddy Wing2016-07-21 17:30:37 -0400
commite2ad8c0877699bceeb4a1484912b8b33a56f99ff (patch)
tree27de322fccf73a5e4509adb8df703d5db79e17d6
downloadqcd-e2ad8c0877699bceeb4a1484912b8b33a56f99ff.tar.bz2
Initial commit. First working version of qcd.v0.0.1
The initial working `qcd` function and bash completion function copied from my dotfiles. Shortcuts and directory paths are specified manually in both scripts.
-rwxr-xr-xqcd17
-rw-r--r--qcd.bash-completion17
2 files changed, 34 insertions, 0 deletions
diff --git a/qcd b/qcd
new file mode 100755
index 0000000..98f2b3b
--- /dev/null
+++ b/qcd
@@ -0,0 +1,17 @@
+# qcd
+# Quickly `cd` into some frequently accessed project directories
+
+function qcd () {
+ if [[ $# < 1 ]]; then
+ echo 'Usage: qcd SHORTCUT' 1>&2
+ return
+ fi
+
+ local command=$1
+
+ case $command in
+ shortcut)
+ cd ${HOME}/path
+ ;;
+ esac
+}
diff --git a/qcd.bash-completion b/qcd.bash-completion
new file mode 100644
index 0000000..f0099e0
--- /dev/null
+++ b/qcd.bash-completion
@@ -0,0 +1,17 @@
+# Bash completion for the qcd() function
+
+_qcd () {
+ local cur
+ local commands=(
+ shortcut
+ )
+
+ COMPREPLY=()
+ cur=${COMP_WORDS[COMP_CWORD]}
+
+ COMPREPLY=( $( compgen -W "${commands[*]}" -- $cur ) )
+
+ return 0
+}
+
+complete -F _qcd qcd