ShellCommandSyntax Class
Represents a simple command: optional assignments, a command name, arguments, and redirections.
public sealed class ShellCommandSyntax : ShellStatementSyntaxRemarks
ShellCommandSyntax.Elements keeps the parts in source order, so a command such as echo >out hi round-trips exactly. Use ShellCommandSyntax.Name, ShellCommandSyntax.Arguments, ShellCommandSyntax.Assignments, and ShellCommandSyntax.Redirections to read the parts by role.
- Inheritance
ShellStatementSyntaxShellCommandSyntax
Properties
| Name | Description |
|---|---|
| Arguments | Every word after the command name. |
| Assignments | The assignments that prefix the command, as in FOO=bar cmd. |
| Elements | |
| Name | The command name, or null for an assignment-only or redirection-only command. |
| NameValue | The command name with quotes and escapes resolved, or null when it needs runtime expansion. |
| Redirections |
Arguments
ShellCommandSyntax.csEvery word after the command name.
public IReadOnlyList<ShellWordSyntax> Arguments { get; }Property value
Assignments
ShellCommandSyntax.csThe assignments that prefix the command, as in FOO=bar cmd.
public IReadOnlyList<ShellAssignmentSyntax> Assignments { get; }Property value
Elements
Syntax.g.csThe command name, or null for an assignment-only or redirection-only command.
public ShellWordSyntax? Name { get; }Property value
NameValue
ShellCommandSyntax.csRedirections
ShellCommandSyntax.cspublic IReadOnlyList<ShellRedirectionSyntax> Redirections { get; }Property value
No documentation is available.
Methods
| Name | Description |
|---|---|
| Accept(ShellSyntaxVisitor) | |
| Accept<TResult>(ShellSyntaxVisitor<TResult>) | |
| Update(SyntaxList<ShellSyntaxNode>) | Returns this node with the given parts, or itself when nothing changed. |
| WithArguments(IEnumerable<ShellWordSyntax>) | Replaces the arguments while keeping the command name, assignments, and redirections in place. |
| WithElements(SyntaxList<ShellSyntaxNode>) | Returns this node with elements in place of its ShellCommandSyntax.Elements. |
Accept overloads
Accept(ShellSyntaxVisitor)
Syntax.g.cspublic override void Accept(ShellSyntaxVisitor visitor)Parameters
visitorShellSyntaxVisitor
No documentation is available.
Accept<TResult>(ShellSyntaxVisitor<TResult>)
Syntax.g.cspublic override TResult? Accept<TResult>(ShellSyntaxVisitor<TResult> visitor)No documentation is available.
Update(SyntaxList<ShellSyntaxNode>)
Syntax.g.csReturns this node with the given parts, or itself when nothing changed.
public ShellCommandSyntax Update(SyntaxList<ShellSyntaxNode> elements)WithArguments(IEnumerable<ShellWordSyntax>)
ShellCommandSyntax.csReplaces the arguments while keeping the command name, assignments, and redirections in place.
public ShellCommandSyntax WithArguments(IEnumerable<ShellWordSyntax> arguments)Parameters
argumentsIEnumerable<ShellWordSyntax>
Returns
Exceptions
ArgumentNullExceptionargumentsisnull.
WithElements(SyntaxList<ShellSyntaxNode>)
Syntax.g.csReturns this node with elements in place of its ShellCommandSyntax.Elements.
public ShellCommandSyntax WithElements(SyntaxList<ShellSyntaxNode> elements)