forked from spectreconsole/spectre.console
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
256 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/Spectre.Console.Cli/Completion/CompletionSuggestionsAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace Spectre.Console.Cli.Completion; | ||
|
||
[System.AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = true)] | ||
internal sealed class CompletionSuggestionsAttribute : Attribute | ||
{ | ||
public string[] Suggestions { get; } | ||
|
||
public CompletionSuggestionsAttribute(params string[] suggestions) | ||
{ | ||
Suggestions = suggestions; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
test/Spectre.Console.Cli.Tests/Data/Commands/UserAddCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Spectre.Console.Cli.Completion; | ||
|
||
namespace Spectre.Console.Cli.Tests.Data.Commands; | ||
|
||
// mycommand user add [name] --age [age] | ||
internal class UserAddSettings : CommandSettings | ||
{ | ||
[CommandArgument(0, "<name>")] | ||
[Description("The name of the user.")] | ||
[CompletionSuggestions("Angelika", "Arnold", "Bernd", "Cloud", "Jonas")] | ||
public string Name { get; set; } | ||
|
||
[CommandOption("-a|--age <age>")] | ||
[Description("The age of the user.")] | ||
[CompletionSuggestions("10", "15", "20", "30")] | ||
public int Age { get; set; } | ||
} | ||
|
||
[Description("The user command.")] | ||
internal class UserAddCommand : Command<UserAddSettings> | ||
{ | ||
public override int Execute(CommandContext context, UserAddSettings settings) | ||
{ | ||
return 0; | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
test/Spectre.Console.Cli.Tests/Expectations/Cli/Complete/Test_23.Output.verified.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
10 | ||
15 |
4 changes: 4 additions & 0 deletions
4
test/Spectre.Console.Cli.Tests/Expectations/Cli/Complete/Test_24.Output.verified.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
10 | ||
15 | ||
20 | ||
30 |
5 changes: 5 additions & 0 deletions
5
test/Spectre.Console.Cli.Tests/Expectations/Cli/Complete/Test_25.Output.verified.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Angelika | ||
Arnold | ||
Bernd | ||
Cloud | ||
Jonas |
2 changes: 2 additions & 0 deletions
2
test/Spectre.Console.Cli.Tests/Expectations/Cli/Complete/Test_26.Output.verified.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Angelika | ||
Arnold |
Oops, something went wrong.