diff options
-rwxr-xr-x | shell-integration/cbt-completions.bash | 6 | ||||
-rw-r--r-- | shell-integration/cbt-completions.fish | 2 | ||||
-rwxr-xr-x | shell-integration/cbt-completions.zsh | 6 | ||||
-rw-r--r-- | stage2/BasicBuild.scala | 4 |
4 files changed, 12 insertions, 6 deletions
diff --git a/shell-integration/cbt-completions.bash b/shell-integration/cbt-completions.bash index 925ba4b..deb88c1 100755 --- a/shell-integration/cbt-completions.bash +++ b/shell-integration/cbt-completions.bash @@ -1,11 +1,13 @@ -#!/bin/bash +# this does currently not support for completion of nested methods, e.g. snapshot.comp<tab> +# bash 4 should be able to do that via $READLINE_LINE and $READLINE_POINT, see +# http://unix.stackexchange.com/questions/106761/simulating-readline-line-in-bash-4-0/106832 __cbt() { local cur prev opts COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" - opts="$(cbt taskNames)" + opts="$(cbt complete)" COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 } diff --git a/shell-integration/cbt-completions.fish b/shell-integration/cbt-completions.fish index fbca62d..d51114d 100644 --- a/shell-integration/cbt-completions.fish +++ b/shell-integration/cbt-completions.fish @@ -1 +1 @@ -complete --command cbt --no-files -a '(cbt taskNames)' #|fzf --height 90% --reverse)' +complete --command cbt --no-files -a '(cbt complete (commandline --current-buffer) (commandline --cursor))' #|fzf --height 90% --reverse)' diff --git a/shell-integration/cbt-completions.zsh b/shell-integration/cbt-completions.zsh index d11307d..d8f2d6d 100755 --- a/shell-integration/cbt-completions.zsh +++ b/shell-integration/cbt-completions.zsh @@ -1,7 +1,9 @@ -#! /usr/bin/env zsh +# this does currently not support for completion of nested methods, e.g. snapshot.comp<tab> +# zsh should be able to do that via $BUFFER, see +# http://unix.stackexchange.com/questions/14230/zsh-tab-completion-on-empty-line _cbt() { - reply=( "${(ps:\n:)$(cbt taskNames)}" ) + reply=( "${(ps:\n:)$(cbt complete)}" ) } compctl -K _cbt cbt diff --git a/stage2/BasicBuild.scala b/stage2/BasicBuild.scala index d7bdfee..1308155 100644 --- a/stage2/BasicBuild.scala +++ b/stage2/BasicBuild.scala @@ -42,7 +42,9 @@ trait BaseBuild extends BuildInterface with DependencyImplementation with Trigge final def help: String = lib.usage(this.getClass, show) - final def taskNames: String = lib.taskNames(this.getClass).sorted.mkString("\n") + final def complete: String = { + lib.taskNames(this.getClass).sorted.mkString("\n") + } // ========== meta data ========== |