Support for commands
See original GitHub issueIssue by fleed Friday Mar 31, 2017 at 04:24 GMT _Originally opened as https://github.com/gsscoder/commandline/issues/434_
Is there any existing way to define commands
, intended as classes to execute specific options? IF not, any plan to add support? I would expect something like this, removing lot of the ceremony required to configure the option and run the related logic:
Example:
class CommitCommand : Command<CommitOptions>
{
public int Execute(CommitOptions options)
{
// execute
return 0;
}
// alternative
public int Execute()
{
// access options as property in AsyncCommand base
var file = this.Options.File;
// execute
return 0;
}
}
class UploadCommand : AsyncCommand<UploadOptions>
{
public async Task<int> ExecuteAsync(CommitOptions options)
{
// execute
return 0;
}
// alternative
public async Task<int> ExecuteAsync()
{
// access options as property in AsyncCommand base
var file = this.Options.File;
// execute
return 0;
}
}
// Program.cs
var parser = new CommandParser();
var parserResult = parser.Parse(args);
var result = parserResult.ExecuteCommand();
In general I’d like the possibility to discover options and commands through reflection, something similar to ManyConsole
.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Show Supports Commands badge on bots in which 75% ...
Show `Supports Commands` badge on bots in which 75%+ guilds have a guild command.
Read more >Command support definition and meaning
Command support definition: If someone in authority commands you to do something, they tell you that you must do it.... | Meaning, pronunciation ......
Read more >Support CLI Commands
There are no functions that you would perform with these commands regularly. support clean audit_results: A way to manually purge audit results, this...
Read more >Help Command: Examples, Options, Switches and More
Curious about how your computer commands work? The help command can help with that. Here's how to use the help command in Command...
Read more >New badge for bots that support slash commands
Though... the prompt for command arguments really helps on complex bot commands tbh (like when using the bots myself). A shame it couldn't...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ericnewton76 sure, but no support for
async
😦 With async main support in C# 7.1, that’s a very important feature.this reply was directed to @fleed .