This repository has been archived by the owner on Jan 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Test cases
Patrik edited this page Jan 25, 2018
·
8 revisions
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