Files
spectre.console/src/Spectre.Console/Cli/CommandContext.cs
Patrik Svensson 0ae419326d Add Spectre.Cli to Spectre.Console
* Renames Spectre.Cli to Spectre.Console.Cli.
* Now uses Verify with Spectre.Console.Cli tests.
* Removes some duplicate definitions.

Closes #168
2020-12-28 17:28:03 +01:00

46 lines
1.4 KiB
C#

namespace Spectre.Console.Cli
{
/// <summary>
/// Represents a command context.
/// </summary>
public sealed class CommandContext
{
/// <summary>
/// Gets the remaining arguments.
/// </summary>
/// <value>
/// The remaining arguments.
/// </value>
public IRemainingArguments Remaining { get; }
/// <summary>
/// Gets the name of the command.
/// </summary>
/// <value>
/// The name of the command.
/// </value>
public string Name { get; }
/// <summary>
/// Gets the data that was passed to the command during registration (if any).
/// </summary>
/// <value>
/// The command data.
/// </value>
public object? Data { get; }
/// <summary>
/// Initializes a new instance of the <see cref="CommandContext"/> class.
/// </summary>
/// <param name="remaining">The remaining arguments.</param>
/// <param name="name">The command name.</param>
/// <param name="data">The command data.</param>
public CommandContext(IRemainingArguments remaining, string name, object? data)
{
Remaining = remaining ?? throw new System.ArgumentNullException(nameof(remaining));
Name = name ?? throw new System.ArgumentNullException(nameof(name));
Data = data;
}
}
}