diff options
-rw-r--r-- | README.md | 5 | ||||
-rwxr-xr-x | shell-integration/cbt-completions.bash | 2 | ||||
-rw-r--r-- | shell-integration/cbt-completions.fish | 1 | ||||
-rw-r--r-- | stage2/BasicBuild.scala | 2 | ||||
-rw-r--r-- | stage2/Stage2.scala | 2 | ||||
-rw-r--r-- | test/simple/build/build.scala | 2 | ||||
-rw-r--r-- | test/test.scala | 6 |
7 files changed, 18 insertions, 2 deletions
@@ -192,3 +192,8 @@ for f in ~/.bash_completion.d/*; do source $f done ``` + +Fish shell completions +---------------- +copy this line into your fish configuration, on OSX: /.config/fish/config.fish +complete -c cbt -a '(cbt taskNames)' diff --git a/shell-integration/cbt-completions.bash b/shell-integration/cbt-completions.bash index c591321..925ba4b 100755 --- a/shell-integration/cbt-completions.bash +++ b/shell-integration/cbt-completions.bash @@ -5,7 +5,7 @@ __cbt() COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" - opts="$(cbt usage)" + opts="$(cbt taskNames)" COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 } diff --git a/shell-integration/cbt-completions.fish b/shell-integration/cbt-completions.fish new file mode 100644 index 0000000..6e543fb --- /dev/null +++ b/shell-integration/cbt-completions.fish @@ -0,0 +1 @@ +complete -c cbt -a (cbt taskNames) diff --git a/stage2/BasicBuild.scala b/stage2/BasicBuild.scala index 410d68f..b2bb72b 100644 --- a/stage2/BasicBuild.scala +++ b/stage2/BasicBuild.scala @@ -25,6 +25,8 @@ trait BaseBuild extends DependencyImplementation with BuildInterface with Trigge final def projectDirectory: File = lib.realpath(context.projectDirectory) assert( projectDirectory.exists, "projectDirectory does not exist: " ++ projectDirectory.string ) final def usage: String = lib.usage(this.getClass, show) + + final def taskNames: String = lib.taskNames(this.getClass).sorted.mkString("\n") // ========== meta data ========== diff --git a/stage2/Stage2.scala b/stage2/Stage2.scala index 9ef96fa..3d5c244 100644 --- a/stage2/Stage2.scala +++ b/stage2/Stage2.scala @@ -32,7 +32,7 @@ object Stage2 extends Stage2Base{ val context: Context = ContextImplementation( args.cwd, args.cwd, - args.args.drop( taskIndex ).toArray, + args.args.drop( taskIndex +1 ).toArray, logger.enabledLoggers.toArray, logger.start, args.cbtHasChanged, diff --git a/test/simple/build/build.scala b/test/simple/build/build.scala index cf41c8c..66ee392 100644 --- a/test/simple/build/build.scala +++ b/test/simple/build/build.scala @@ -35,4 +35,6 @@ class Build(val context: cbt.Context) extends BaseBuild{ "ai.x" %% "lens" % "1.0.0" ) ) + + def printArgs = context.args.mkString(" ") } diff --git a/test/test.scala b/test/test.scala index 65790f8..4f332ea 100644 --- a/test/test.scala +++ b/test/test.scala @@ -197,6 +197,12 @@ object Main{ compile("../examples/uber-jar-example") { + val res = runCbt("simple", Seq("printArgs","1","2","3")) + assert(res.exit0) + assert(res.out == "1 2 3", res.out) + } + + { val res = runCbt("forgot-extend", Seq("run")) assert(!res.exit0) assert(res.err contains "Build cannot be cast to cbt.BuildInterface", res.err) |