CommandTrait line argument type and the associated class parameter
CommandTrait line option and the associated class parameter
command-line option
Cannonical name.
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
Builds method call arguments
OptionSchema created from a method definition
CommandTrait-line argument parser
Schema of the command line options
Utility for managing names written in different spellings.
Utility for managing names written in different spellings. For example, variable name localAddress can be written as "local address", "local_address", etc.
CanonicalName is the representative name of these variants.
CName("localAddress") == CName("local address") == CName("local_address")
Tokenize single string representations of command line arguments into Array[String]
Command launcher
Creates option parsers
Cannonical name. This name is used as a common name of wording variants (e.g., difference of capital letter usage, hyphenation, etc.)