ShellCommandSyntax Class

Represents a simple command: optional assignments, a command name, arguments, and redirections.

public sealed class ShellCommandSyntax : ShellStatementSyntax

Remarks

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
ShellStatementSyntax ShellCommandSyntax

Properties

NameDescription
ArgumentsEvery word after the command name.
AssignmentsThe assignments that prefix the command, as in FOO=bar cmd.
Elements
NameThe command name, or null for an assignment-only or redirection-only command.
NameValueThe command name with quotes and escapes resolved, or null when it needs runtime expansion.
Redirections

Every word after the command name.

public IReadOnlyList<ShellWordSyntax> Arguments { get; }

The assignments that prefix the command, as in FOO=bar cmd.

public IReadOnlyList<ShellAssignmentSyntax> Assignments { get; }

Elements

Syntax.g.cs
public SyntaxList<ShellSyntaxNode> Elements { get; }

No documentation is available.

The command name, or null for an assignment-only or redirection-only command.

public ShellWordSyntax? Name { get; }

Property value

ShellWordSyntax?

The command name with quotes and escapes resolved, or null when it needs runtime expansion.

public string? NameValue { get; }

Property value

string?

public IReadOnlyList<ShellRedirectionSyntax> Redirections { get; }

No documentation is available.

Methods

NameDescription
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.cs
public override void Accept(ShellSyntaxVisitor visitor)
Parameters
visitor ShellSyntaxVisitor

No documentation is available.

Accept<TResult>(ShellSyntaxVisitor<TResult>)

Syntax.g.cs
public override TResult? Accept<TResult>(ShellSyntaxVisitor<TResult> visitor)
Type parameters
TResult
Parameters
visitor ShellSyntaxVisitor<TResult>
Returns

TResult?

No documentation is available.

Update(SyntaxList<ShellSyntaxNode>)

Syntax.g.cs

Returns this node with the given parts, or itself when nothing changed.

WithArguments(IEnumerable<ShellWordSyntax>)

ShellCommandSyntax.cs

Replaces the arguments while keeping the command name, assignments, and redirections in place.

public ShellCommandSyntax WithArguments(IEnumerable<ShellWordSyntax> arguments)

Parameters

arguments IEnumerable<ShellWordSyntax>

Returns

ShellCommandSyntax

Exceptions

ArgumentNullException
arguments is null.

WithElements(SyntaxList<ShellSyntaxNode>)

Syntax.g.cs

Returns this node with elements in place of its ShellCommandSyntax.Elements.

public ShellCommandSyntax WithElements(SyntaxList<ShellSyntaxNode> elements)