We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
public class AnimalSettings { [Option("-a|--alive [VALUE]")] public bool IsAlive { get; set; } [Argument(1, "[LEGS]")] public int Legs { get; set; } } public class MammalSettings : AnimalSettings { [Option("--name <VALUE>")] public string Name { get; set; } } public class DogSettings : MammalSettings { [Option("-g|--good-boy [VALUE]")] public bool GoodBoy { get; set; } [Argument(0, "[AGE]")] public int Age { get; set; } } public class DogCommand : Command<DogSettings> { } public class HorseCommand : Command<MammalSettings> { }
config.AddCommand<AnimalSettings>("animal", animal => { animal.AddCommand<MammalSettings>("mammal", mammal => { mammal.AddCommand<DogCommand>("dog"); mammal.AddCommand<HorseCommand>("horse"); }); });
./program.exe animal --alive mammal --name Rufus dog 12 --good-boy Legs = 0 Age=12 GoodBoy=true Name=Rufus IsAlive=true
config.AddCommand<DogCommand>("dog");
./program.exe dog 12 4 --good-boy --name Rufus --alive Legs = 4 Age=12 GoodBoy=true Name=Rufus IsAlive=true
config.AddCommand<AnimalSettings>("animal", animal => { animal.AddCommand<DogCommand>("dog"); animal.AddCommand<HorseCommand>("horse"); });
./program.exe animal dog 12 --good-boy --name Rufus Legs = 0 Age=12 GoodBoy=true Name=Rufus IsAlive=false
config.AddCommand<AnimalSettings>("animal", animal => { animal.AddCommand<DogCommand>("dog"); });
./program.exe animal 4 dog 12 --good-boy --name Rufus Legs = 4 Age=12 GoodBoy=true Name=Rufus IsAlive=false