mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-20 05:48:14 +08:00
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
This commit is contained in:

committed by
Patrik Svensson

parent
0bbf9b81a9
commit
0ae419326d
45
src/Spectre.Console/Cli/CommandContext.cs
Normal file
45
src/Spectre.Console/Cli/CommandContext.cs
Normal file
@ -0,0 +1,45 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user