-
-
Save agc93/a84c9daff32a50c01f135816d48141d7 to your computer and use it in GitHub Desktop.
Sample of Spectre desired behaviour
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
public class MyCommand : Command<MyCommandSettings> { /* TRIMMED */ } | |
public class MyOtherCommand : Command<MyOtherCommandSettings> { /* TRIMMED */ } |
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
// EXTRACT ONLY | |
var app = new CommandApp(); | |
app.Configure(config => | |
{ | |
/*// Register commands. */ | |
config.AddProxy<ProxySettings>("proxy", profile => | |
{ | |
profile.AddCommand<MyCommand>("child"); | |
profile.AddCommand<MyOtherCommand>("other"); | |
}); | |
// Run the application. | |
}); | |
return app.Run(args); |
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
public class ProxySettings {} | |
public abstract class SharedCommandSettings : ProxySettings | |
{ | |
[Argument(0, argumentName: "[Name]")] | |
[Description("Name")] | |
public virtual string Name {get;set;} | |
} | |
public sealed class MyCommandSettings : SharedCommandSettings | |
{ | |
[Option("--from <SOURCE>")] | |
public string Source {get;set;} | |
} | |
public sealed class MyOtherCommandSettings : SharedCommandSettings | |
{ | |
[Option("--verbose")] | |
public bool Verbose {get;set;} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment