Package org.metricshub.jawk
Class Cli
java.lang.Object
org.metricshub.jawk.Cli
Command-line interface for Jawk.
-
Constructor Summary
ConstructorsConstructorDescriptionCli()Creates a CLI instance wired to the standard input and output streams.Cli(InputStream in, PrintStream out, PrintStream err) Creates a CLI instance using the supplied streams. -
Method Summary
Modifier and TypeMethodDescriptionstatic Clicreate(String[] args, InputStream is, PrintStream os, PrintStream es) Convenience factory that parses arguments, executes the CLI, and returns the configured instance.Returns the precompiled tuples loaded via the-Loption, if any.Returns the list of script sources specified on the command line.Returns the mutableAwkSettingsconfigured from the command line.booleanstatic voidEntry point for the command-line interface.voidParses the supplied command-line arguments and configures this instance accordingly.static CliparseCommandLineArguments(String[] args) Parses command-line arguments into a newCliinstance without executing it.voidrun()Executes the CLI based on the previously parsed arguments.
-
Constructor Details
-
Cli
public Cli()Creates a CLI instance wired to the standard input and output streams. -
Cli
Creates a CLI instance using the supplied streams. The error stream is currently unused but kept for API symmetry with typical Java main methods.- Parameters:
in- stream from which program input is readout- stream where program output is writtenerr- stream where error messages could be written
-
-
Method Details
-
getSettings
Returns the mutableAwkSettingsconfigured from the command line.- Returns:
- the settings object populated during argument parsing
-
isSandbox
public boolean isSandbox() -
getScriptSources
Returns the list of script sources specified on the command line.- Returns:
- defensive copy of the script sources list
-
getPrecompiledTuples
Returns the precompiled tuples loaded via the-Loption, if any.- Returns:
- the tuples or
nullif none were loaded
-
parse
Parses the supplied command-line arguments and configures this instance accordingly.- Parameters:
args- command-line arguments
-
run
Executes the CLI based on the previously parsed arguments.- Throws:
Exception- if compilation or execution fails
-
parseCommandLineArguments
Parses command-line arguments into a newCliinstance without executing it.- Parameters:
args- command-line arguments- Returns:
- configured CLI instance
-
create
public static Cli create(String[] args, InputStream is, PrintStream os, PrintStream es) throws Exception Convenience factory that parses arguments, executes the CLI, and returns the configured instance.- Parameters:
args- command-line argumentsis- input stream for program inputos- output stream for program outputes- error stream for diagnostic messages- Returns:
- configured and executed CLI instance
- Throws:
Exception- if execution fails
-
main
Entry point for the command-line interface.- Parameters:
args- command-line arguments
-