CommandTrait line argument type and the associated class parameter
CommandTrait line option and the associated class parameter
command-line option
OptionSchema created from a class definition
// Define your command set class MyCommandSet { \@command def hello = println("hello") \@command def world = println("world") } // Integrate the above command set as a module with a given name. // Command can be invoked as "sample hello" and "sample world". class MyModule extends CommandModule { def modules = Seq(ModuleDef("sample", classOf[MyCommandSet], description="my command set")) } Launcher[MyModule].execute("sample hello") // prints hello
Implement this trait to supply a default command invoked when no command name is specified.
Command launcher.
Command launcher.
class MyCommand(@option(prefix="-h,--help", description="display help", isHelp=true) help:Boolean) { @command(description="Say hello") def hello(@option(prefix="-r", description="repeat times") repeat:Int=1, @argument message:String = "hello") { for(i <- 0 until repeat) println(message) } } Launcher.execute[MyCommand]("hello -r 3") // hello x 3
OptionSchema created from a method definition
CommandTrait-line argument parser
Schema of the command line options
Command launcher
Creates option parsers
Provides command line parser.