Class CommandLineArgs
Contains the parsed command-line arguments for an Atom build execution, providing a structured representation of user input.
public sealed record CommandLineArgs
- Inheritance
-
objectCommandLineArgs
Remarks
An instance of this record is created by the Invex.Atom.Build.Args.CommandLineArgsParser after parsing the raw string arguments provided to the Atom application.
Constructors
CommandLineArgs(bool, IEnumerable<IArg>, IEnumerable<ParseError>?)
Contains the parsed command-line arguments for an Atom build execution, providing a structured representation of user input.
public CommandLineArgs(bool IsValid, IEnumerable<IArg> Args, IEnumerable<ParseError>? Errors = null)
Parameters
IsValidboolA value indicating whether the command-line arguments were parsed successfully and are valid. If false, the Atom application will typically terminate or display help.
ArgsIEnumerable<IArg>A read-only list of IArg objects representing the individual arguments parsed from the command line. This list provides access to raw argument objects like HelpArg, CommandArg, or ParamArg.
ErrorsIEnumerable<ParseError>The ParseError objects describing any problems encountered while parsing the raw arguments. When non-empty, IsValid is forced to false.
Remarks
An instance of this record is created by the Invex.Atom.Build.Args.CommandLineArgsParser after parsing the raw string arguments provided to the Atom application.
Properties
Args
A read-only list of IArg objects representing the individual arguments parsed from the command line. This list provides access to raw argument objects like HelpArg, CommandArg, or ParamArg.
public IReadOnlyList<IArg> Args { get; init; }
Property Value
- IReadOnlyList<IArg>
Commands
Gets a read-only list of command arguments (CommandArg) from the command line.
public IReadOnlyList<CommandArg> Commands { get; }
Property Value
- IReadOnlyList<CommandArg>
A read-only list of CommandArg objects.
Remarks
Each CommandArg represents a target to be executed.
For atom Clean Build, this list would contain "Clean" and "Build".
- See Also
Errors
A read-only list of ParseError objects describing any problems encountered while parsing the raw arguments, such as unknown arguments or options that are missing their values.
public IReadOnlyList<ParseError> Errors { get; init; }
Property Value
- IReadOnlyList<ParseError>
Remarks
Parsing never throws or writes to the console; errors are collected here and reported by the Atom application after the host is fully constructed, so that all output can be masked for secrets.
HasHeadless
Gets a value indicating whether the headless argument (-hl or --headless) was provided.
public bool HasHeadless { get; }
Property Value
- bool
true if the headless argument is present; otherwise, false.
Remarks
This mode is used for non-interactive environments like CI/CD pipelines, where user prompts should be disabled.
Running atom MyCommand --headless or atom MyCommand -hl will result in this property being true.
- See Also
HasHelp
Gets a value indicating whether the help argument (-h or --help) was provided.
public bool HasHelp { get; }
Property Value
- bool
true if the help argument is present; otherwise, false.
Remarks
When this property is true, the Atom application should display help information and exit.
Running atom --help or atom -h will result in this property being true.
- See Also
HasInteractive
Gets a value indicating whether the interactive argument (-i or --interactive) was provided.
public bool HasInteractive { get; }
Property Value
- bool
true if the interactive argument is present; otherwise, false.
Remarks
This flag suggests that the Atom application may prompt the user for input if needed for certain parameters.
Running atom MyCommand -i will result in this property being true.
- See Also
-
ParamService
HasProject
Gets a value indicating whether the project argument (-p or --project) was provided.
public bool HasProject { get; }
Property Value
- bool
true if the project argument is present; otherwise, false.
Remarks
This argument allows specifying a custom Atom project directory, overriding the default.
Running atom -p MyAtomProject will result in this property being true.
- See Also
HasSkip
Gets a value indicating whether the skip argument (-s or --skip) was provided.
public bool HasSkip { get; }
Property Value
- bool
true if the skip argument is present; otherwise, false.
Remarks
This flag instructs the build executor to skip the execution of dependent targets.
Running atom MyTarget --skip or atom MyTarget -s will result in this property being true.
- See Also
-
BuildExecutor
HasVerbose
Gets a value indicating whether the verbose argument (-v or --verbose) was provided.
public bool HasVerbose { get; }
Property Value
- bool
true if the verbose argument is present; otherwise, false.
Remarks
When true, the Atom application should output more detailed logging information for debugging or diagnostics.
Running atom MyCommand --verbose or atom MyCommand -v will result in this property being true.
- See Also
IsValid
A value indicating whether the command-line arguments were parsed successfully and are valid. If false, the Atom application will typically terminate or display help.
public bool IsValid { get; init; }
Property Value
- bool
Params
Gets a read-only list of parameter arguments (ParamArg) from the command line.
public IReadOnlyList<ParamArg> Params { get; }
Property Value
Remarks
Each ParamArg represents a key-value pair (e.g., --my-param value).
For atom --param1 value1, this list would contain one ParamArg object.
- See Also
ProjectName
Gets the project name specified by the project argument (-p or --project).
public string ProjectName { get; }
Property Value
- string
The specified project name, or "_atom" if not provided.
Remarks
If the project argument is not provided, this defaults to "_atom".
The Atom project typically resides in a directory with this name.
If atom -p MyBuildScripts is run, this property will be "MyBuildScripts".
- See Also
Methods
GetValidationErrors()
Gets a list of validation errors for the current command-line arguments.
public IReadOnlyList<string> GetValidationErrors()
Returns
- IReadOnlyList<string>
A read-only list of error messages. An empty list indicates no validation errors.