Commands

com.ossuminc.riddl.commands.Commands
object Commands

Attributes

Source
Commands.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Commands.type

Members list

Value members

Concrete methods

def loadCandidateCommands(configFile: Path, log: Logger, commonOptions: CommonOptions): Either[Messages, Seq[String]]

Attributes

Source
Commands.scala
def loadCommandNamed(name: String, log: Logger, commonOptions: CommonOptions): Either[Messages, Command[_]]

Convert a string and some com.ossuminc.riddl.language.CommonOptions into either a com.ossuminc.riddl.command.Command or some com.ossuminc.riddl.language.Messages.Messages Note that the com.ossuminc.riddl.command.CommandOptions will be passed to the command when you run it.

Convert a string and some com.ossuminc.riddl.language.CommonOptions into either a com.ossuminc.riddl.command.Command or some com.ossuminc.riddl.language.Messages.Messages Note that the com.ossuminc.riddl.command.CommandOptions will be passed to the command when you run it.

Value parameters

commonOptions

The com.ossuminc.riddl.language.CommonOptions to provide to the command.

name

THe name of the command to be converted

Attributes

Returns
Source
Commands.scala
def optional[T](objCur: ConfigObjectCursor, key: String, default: T)(mapIt: ConfigCursor => Result[T]): Result[T]

A helper function for reading optional items from a config file.

A helper function for reading optional items from a config file.

Type parameters

T

The Scala type of the config item's value

Value parameters

default

The default value of the config item

key

The name of the optional config item

mapIt

The function to map ConfigCursor to ConfigReader.Result[T]

objCur

The ConfigObjectCursor to start with

Attributes

Returns

The reader for this optional configuration item.

Source
Commands.scala
def runCommandNamed(name: String, optionsPath: Path, log: Logger, commonOptions: CommonOptions, outputDirOverride: Option[Path]): Either[Messages, PassesResult]

Attributes

Source
Commands.scala

Probably the easiest way to run a command if you're familiar with the command line options and still get the com.ossuminc.riddl.language.Messages.Messages or com.ossuminc.riddl.passes.PassesResult objects out of it.

Probably the easiest way to run a command if you're familiar with the command line options and still get the com.ossuminc.riddl.language.Messages.Messages or com.ossuminc.riddl.passes.PassesResult objects out of it.

Value parameters

args

An Array of arguments, one argument per array element. This should follow the same pattern as by the riddlc command line options (run riddlc help to discover that syntax). Unlike riddlc, the first argument must be the name of the command to run. The common options cannot occur ahead of it and are provided by the commonOptions argument to this function.

commonOptions

The com.ossuminc.riddl.language.CommonOptions that control things like which kinds of messages to put out, whether verbose, debug or quiet mode should be used, whether to show pass and include run times, how to sort the message, whether ANSI color codes should be emitted, etc.

log

An instance of one of the com.ossuminc.riddl.utils.Logger subclasses. This is where all the output from the command will flow, should it succeed. The volume of output can be affected by many of the com.ossuminc.riddl.language.CommonOptions

Attributes

Returns
Source
Commands.scala
def runFromConfig(configFile: Option[Path], targetCommand: String, commonOptions: CommonOptions, log: Logger, commandName: String): Either[Messages, PassesResult]

An easy way to run the from command which loads commands and their options from a .config file and uses them as defaults.

An easy way to run the from command which loads commands and their options from a .config file and uses them as defaults. The com.ossuminc.riddl.language.CommonOptions specification in the .config file can be overridden with the commonOptions argument.

Value parameters

commandName

The name of the command that is invoking this method, if it matters

commonOptions

Overrides the common-options section in the configFile.

configFile

An optional java.nio.file.Path for the config file. Relative or full paths are fine.

log

Where to send the commands output. See com.ossuminc.riddl.utils.Logger and its subclasses for options.

targetCommand

The command to run. This must match a config setting in the configFile that provides the arguments for that command.

Attributes

Returns

One of two things:

Source
Commands.scala
def runMain(args: Array[String], log: Logger): Int

Attributes

Source
Commands.scala