lingua-franca 0.10.1
Lingua Franca code generator
Loading...
Searching...
No Matches
org.lflang.cli.CliBase Class Referenceabstract

Base class for standalone CLI applications. More...

Inherits Runnable.

Inherited by org.lflang.cli.Lfc, org.lflang.cli.Lfd, and org.lflang.cli.Lff.

Classes

class  MutuallyExclusive
 Options and parameters present in both Lfc and Lff. More...

Public Member Functions

void doExecute (Io io, String[] args)
abstract void doRun ()
Resource getResource (Path path)
 Obtains a resource from a path.
List< LfIssue > printErrorsIfAny ()
 If any warnings were collected, print them, then return them.
List< LfIssue > printWarningsIfAny ()
 If any warnings were collected, print them, then return them.
void run ()
 The entrypoint of Picocli applications - the first method called when CliBase, which implements the Runnable interface, is instantiated.
void validateResource (Resource resource)
 Validates a given resource.

Static Public Member Functions

static Injector getInjector (String toolName, Io io)

Protected Member Functions

void exitIfCollectedErrors ()
 If some errors were collected, print them and abort execution.
List< Path > getInputPaths ()
 Returns the validated input paths.
final JsonObject getJsonObject ()
Path getOutputRoot ()
 Returns the validated, normalized output path.
final boolean stdinMode ()
Path toAbsolutePath (Path other)
 Resolve to an absolute path, in the given io context.

Static Protected Member Functions

static void cliMain (String toolName, Class<? extends CliBase > toolClass, Io io, String[] args)

Protected Attributes

Io io
 IO context of this run.
IssueCollector issueCollector
 Used to collect all errors that happen during validation/generation.
MessageReporter messageReporter
 Used to report error messages at the end.
ReportingBackend reporter
 Used to report error messages at the end.

Package Attributes

CommandSpec spec
 Models a command specification, including the options, positional parameters and subcommands supported by the command.
MutuallyExclusive topLevelArg

Detailed Description

Base class for standalone CLI applications.

Author
Marten Lohstroh
Christian Menard
Billy Bao
Atharva Patil

Member Function Documentation

◆ cliMain()

void org.lflang.cli.CliBase.cliMain ( String toolName,
Class<? extends CliBase > toolClass,
Io io,
String[] args )
staticprotected

◆ doExecute()

void org.lflang.cli.CliBase.doExecute ( Io io,
String[] args )

◆ doRun()

abstract void org.lflang.cli.CliBase.doRun ( )
abstract

◆ exitIfCollectedErrors()

void org.lflang.cli.CliBase.exitIfCollectedErrors ( )
protected

If some errors were collected, print them and abort execution.

Otherwise, return.

◆ getInjector()

Injector org.lflang.cli.CliBase.getInjector ( String toolName,
Io io )
static

◆ getInputPaths()

List< Path > org.lflang.cli.CliBase.getInputPaths ( )
protected

Returns the validated input paths.

Returns
Validated input paths.

◆ getJsonObject()

final JsonObject org.lflang.cli.CliBase.getJsonObject ( )
protected

◆ getOutputRoot()

Path org.lflang.cli.CliBase.getOutputRoot ( )
protected

Returns the validated, normalized output path.

Returns
Validated, normalized output path.

◆ getResource()

Resource org.lflang.cli.CliBase.getResource ( Path path)

Obtains a resource from a path.

Returns null if path is not an LF file.

Parameters
pathThe path to obtain the resource from.
Returns
The obtained resource. Set to null if path is not an LF file.

◆ printErrorsIfAny()

List< LfIssue > org.lflang.cli.CliBase.printErrorsIfAny ( )

If any warnings were collected, print them, then return them.

Returns
A list of collected errors.

◆ printWarningsIfAny()

List< LfIssue > org.lflang.cli.CliBase.printWarningsIfAny ( )

If any warnings were collected, print them, then return them.

Returns
A list of collected warnings.

◆ run()

void org.lflang.cli.CliBase.run ( )

The entrypoint of Picocli applications - the first method called when CliBase, which implements the Runnable interface, is instantiated.

◆ stdinMode()

final boolean org.lflang.cli.CliBase.stdinMode ( )
protected

◆ toAbsolutePath()

Path org.lflang.cli.CliBase.toAbsolutePath ( Path other)
protected

Resolve to an absolute path, in the given io context.

◆ validateResource()

void org.lflang.cli.CliBase.validateResource ( Resource resource)

Validates a given resource.

If issues arise during validation, these are recorded using the issue collector.

Parameters
resourceThe resource to validate.

Member Data Documentation

◆ io

Io org.lflang.cli.CliBase.io
protected

IO context of this run.

◆ issueCollector

IssueCollector org.lflang.cli.CliBase.issueCollector
protected

Used to collect all errors that happen during validation/generation.

◆ messageReporter

MessageReporter org.lflang.cli.CliBase.messageReporter
protected

Used to report error messages at the end.

◆ reporter

ReportingBackend org.lflang.cli.CliBase.reporter
protected

Used to report error messages at the end.

◆ spec

CommandSpec org.lflang.cli.CliBase.spec
package

Models a command specification, including the options, positional parameters and subcommands supported by the command.

◆ topLevelArg

MutuallyExclusive org.lflang.cli.CliBase.topLevelArg
package

The documentation for this class was generated from the following file:
  • /Users/runner/work/lingua-franca/lingua-franca/cli/base/src/main/java/org/lflang/cli/CliBase.java