object Sopt
Facade into Sopt that allows for both parsing of command lines to generate command objects and also inspection of command classes.
- Alphabetic
- By Inheritance
- Sopt
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
case class
Arg
(name: String, group: Option[String], flag: Option[Char], kind: String, minValues: Int, maxValues: Int, defaultValues: Seq[String], sensitive: Boolean, description: String) extends MarkDownDescription with Product with Serializable
Represents information about an argument to a command line program.
Represents information about an argument to a command line program.
- name
the name of the argument as presented on the command line
- group
the (optional) name of the group in which the argument exists
- flag
the optional flag character for the argument if it has one
- kind
the name of the type of the argument (for collection arguments, the type in the collection)
- minValues
the minimum number of values that must be specified
- maxValues
the maximum number of values that may be specified
- defaultValues
the seq of default values, as strings
- sensitive
if true the argument is sensitive and values should not be re-displayed
- description
the description of the argument
-
case class
ClpMetadata
(name: String, group: Group, hidden: Boolean, description: String, args: Seq[Arg]) extends MarkDownDescription with Product with Serializable
Represents the metadata about a command line program that may be consumed externally to generate documentation etc.
Represents the metadata about a command line program that may be consumed externally to generate documentation etc.
- name
the name of the program / command
- group
the clp group name of the program
- hidden
whether or not the program is marked as hidden
- description
the description/documentation for the program in MarkDown format
- args
the ordered Seq of arguments the program takes
-
case class
CommandSuccess
[A](command: A) extends Result[A, Nothing] with Product with Serializable
The result type when a single command is successfully parsed.
-
case class
Failure
(usage: () ⇒ String) extends Result[Nothing, Nothing] with Product with Serializable
The result type when a parsing failure occurrs.
-
case class
Group
(name: String, description: String, rank: Int) extends ClpGroup with Product with Serializable
Represents the group to which command line programs belong.
-
trait
MarkDownDescription
extends AnyRef
- Attributes
- protected
-
sealed
trait
Result
[Command, Subcommand] extends AnyRef
Trait representing the results of trying to parse commands, and sub-commands, in sopt.
-
case class
SubcommandSuccess
[A, B](command: A, subcommand: B) extends Result[A, B] with Product with Serializable
The result type when a command/sub-command pair are successfully parsed.
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
val
TerminalWidth: Int
The assumed width of the terminal.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
find[A](packages: Traversable[String], includeHidden: Boolean = false)(implicit arg0: ClassTag[A], arg1: scala.reflect.api.JavaUniverse.TypeTag[A]): Seq[Class[_ <: A]]
Finds classes that extend the given type within the specified packages.
Finds classes that extend the given type within the specified packages.
- A
the type of the commands to find
- packages
one or more fully qualified packages (e.g. com.fulcrumgenomics.sopt')
- includeHidden
whether or not to include programs marked as hidden
- returns
the resulting set of command classes
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
def
inspect[A](clp: Class[A]): ClpMetadata
Inspect a command class that is annotated with clp and arg annotations.
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
parseCommand[Command](name: String, args: Seq[String], commands: Traversable[Class[_ <: Command]])(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[Command], arg1: ClassTag[Command]): Result[_ <: Command, Nothing]
Parses a command line for a single command.
Parses a command line for a single command. Expects that the command name is the first value in the arguments, and that the remainder are arguments to the command.
- Command
the parent type of all command classes
- name
the name of the toolkit, to be printed in usage statements
- args
the ordered sequence of arguments from the command line
- commands
the set of possible command classes to select from
- returns
the result of parsing the command
-
def
parseCommandAndSubCommand[Command, SubCommand](name: String, args: Seq[String], subcommands: Traversable[Class[_ <: SubCommand]])(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[Command], arg1: ClassTag[Command], arg2: scala.reflect.api.JavaUniverse.TypeTag[SubCommand], arg3: ClassTag[SubCommand]): Result[_ <: Command, _ <: SubCommand]
Parses a command line for a command/sub-command pair.
Parses a command line for a command/sub-command pair. The arguments should contain, in order, any arguments to the primary command, the name of the sub-command, and then the arguments to the sub-command.
- Command
the type of the command class
- SubCommand
the parent type of all the subcommands
- name
the name of the toolkit, to be printed in usage statements
- args
the ordered sequence of arguments from the command line
- subcommands
the set of possible subcommand classes to select from
- returns
the result of parsing the command
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )