PrivilegedActionCommand class

Namespace Runic.Platform in Runic.Platform 0.23.0

public sealed class PrivilegedActionCommand : IEquatable<PrivilegedActionCommand>

Inherits or implements IEquatable.

A command of a PrivilegedActionDeclaration: the first argument after the verb, and a pattern for each argument that may follow it.

Remarks

Declare commands with RunicPrivilegedCommand items. A command is equal to another with the same name, patterns and PrivilegedActionCommand.MinimumArguments.

Constructors

PrivilegedActionCommand

public PrivilegedActionCommand(string name, params string[] argumentPatterns)

Declares a command.

Parameters

name

The command's name, which the first argument after the verb must equal.

argumentPatterns

One pattern for each argument after the name, in order, each matched against the whole argument like PrivilegedActionDeclaration.ArgumentPattern. The command accepts no more arguments than patterns.

Exceptions

ArgumentException

The name is empty, longer than PrivilegedActionDeclaration.ArgumentLengthLimit or contains a NUL character, a pattern is null, or there are more than PrivilegedActionDeclaration.ArgumentLimit minus one patterns.

Properties

ArgumentPatterns

public ImmutableArray<string> ArgumentPatterns { get; }

The patterns of the arguments after the name, by position.

MinimumArguments

public int MinimumArguments { get; init; }

How many arguments after the name are required, from 0 to the number of PrivilegedActionCommand.ArgumentPatterns; the rest may be left out from the end. The default requires them all.

Exceptions

ArgumentOutOfRangeException

The value is negative or greater than the number of patterns.

Name

public string Name { get; }

The command's name, the first argument after the verb.

Methods

Equals

public bool Equals(PrivilegedActionCommand? other)

Inherits documentation from IEquatable.Equals.

Equals

public override bool Equals(object? obj)

Inherits documentation from Object.Equals.

GetHashCode

public override int GetHashCode()

Inherits documentation from Object.GetHashCode.

ToString

public override string ToString()

Inherits documentation from Object.ToString.