diff options
author | Jan Christopher Vogt <oss.nsp@cvogt.org> | 2016-08-29 09:19:15 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-29 09:19:15 -0400 |
commit | 4696456fed668bcce279ecf28ae02ee43d32f741 (patch) | |
tree | 9ba1028a0c479aad812870dc349b44e1d299627b | |
parent | 60e50aa8588c8c91e3b9a0e0d3ecf9195a0665fa (diff) | |
parent | 36ae0d245f6103956cf3577afa403abc956f23e5 (diff) | |
download | cbt-4696456fed668bcce279ecf28ae02ee43d32f741.tar.gz cbt-4696456fed668bcce279ecf28ae02ee43d32f741.tar.bz2 cbt-4696456fed668bcce279ecf28ae02ee43d32f741.zip |
Merge pull request #211 from cvogt/completions
Completions
-rw-r--r-- | README.md | 16 | ||||
-rwxr-xr-x | cbt | 1 | ||||
-rwxr-xr-x | shell-integration/cbt-completions.bash | 13 |
3 files changed, 30 insertions, 0 deletions
@@ -176,3 +176,19 @@ solution could be code generating traits at build-time and mixing them in ad-hoc. It's a build-tool after all. Build-time code-generation and class loading is not rocket science. But there may be simpler solutions for the cases at hand. And they are edge cases anyways. + +Bash completions +---------------- +To auto-complete cbt task names in bash do this: + +``` +mkdir ~/.bash_completion.d/ +cp shell-integration/cbt-completions.bash ~/.bash_completion.d/ +``` + +Add this to you .bashrc +``` +for f in ~/.bash_completion.d/*; do + source $f +done +``` @@ -7,6 +7,7 @@ # - reduce code size by moving more of this into type-checked Java/Scala code (if possible without performance loss). # - reduction of dependencies # - performance improvements +shopt -qs extglob seconds() { date +"%s" diff --git a/shell-integration/cbt-completions.bash b/shell-integration/cbt-completions.bash new file mode 100755 index 0000000..c591321 --- /dev/null +++ b/shell-integration/cbt-completions.bash @@ -0,0 +1,13 @@ +#!/bin/bash +__cbt() +{ + local cur prev opts + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + opts="$(cbt usage)" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 +} + +complete -F __cbt cbt |