Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alveflo/commander.net
Command line parsing
https://github.com/alveflo/commander.net
Last synced: 14 days ago
JSON representation
Command line parsing
- Host: GitHub
- URL: https://github.com/alveflo/commander.net
- Owner: alveflo
- License: mit
- Created: 2015-11-07T12:00:45.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-30T16:21:52.000Z (about 9 years ago)
- Last Synced: 2023-08-04T01:03:41.434Z (over 1 year ago)
- Language: C#
- Size: 40 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Commando
Command line parsing inspired by [Commander.js](https://github.com/tj/commander.js)### Example usage
```csharp
public static void Main (string[] args)
{
dynamic program = new Commando()
.Version("0.0.1")
.Parameter("p", "pizza", "Some pizza", true)
.Parameter("d", "drink", "Some drink", true)
.Switch("v", "vegetables", "Want vegetables?", false)
.Parse(args);if (program.pizza != "Margherita")
Console.WriteLine("We only serve margheritas!");
if (program.vegetables)
Console.WriteLine("We're out of vegetables!");Console.WriteLine(String.Format("You've ordered a {0} with {1}",
program.pizza,
program.drink));
}
```
Result
```
$ program -p Capricciosa -d Coke -v
We only serve margheritas!
We're out of vegetables!
You've ordered a Capricciosa with Coke
```#### Generated help
Passing `-h` or `--help` to the example above will output
```
$ program --helpUsage: [options]
Options:
-h, --help Get help
-V, --Version Get version
-p, --pizza Some pizza (Mandatory)
-d, --drink Some drink (Mandatory)
-v, --vegetables Want vegetables?```
### License
MIT