Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/docopt/docopt.net
Port of docopt to .net
https://github.com/docopt/docopt.net
cli command-line docopt hacktoberfest
Last synced: 10 days ago
JSON representation
Port of docopt to .net
- Host: GitHub
- URL: https://github.com/docopt/docopt.net
- Owner: docopt
- License: other
- Created: 2013-07-04T15:09:19.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2024-07-27T13:27:47.000Z (3 months ago)
- Last Synced: 2024-07-31T21:53:17.976Z (3 months ago)
- Topics: cli, command-line, docopt, hacktoberfest
- Language: C#
- Homepage: https://docopt.github.io/docopt.net/
- Size: 18.7 MB
- Stars: 350
- Watchers: 18
- Forks: 33
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT
Awesome Lists containing this project
- awesome-csharp - Docopt - Command-line interface description language that will make you smile. (CLI)
- awesome-dotnet-cn - Docopt - 好用到不行的命令行接口描述语言。 (CLI)
- awesome-dotnet - Docopt - Command-line interface description language that will make you smile. (CLI)
- RSCG_Examples - docopt.net
- awesome-dot-dev - Docopt - Command-line interface description language that will make you smile. (CLI)
- csharp-source-generators - docopt.net - ![stars](https://img.shields.io/github/stars/docopt/docopt.net?style=flat-square&cacheSeconds=604800) ![last commit](https://img.shields.io/github/last-commit/docopt/docopt.net?style=flat-square&cacheSeconds=86400) generates C# source code that parses command-line arguments into a strong-typed arguments class (also generated), given _just_ the [POSIX-style usage in plain text](http://docopt.org/) as part of the CLI. In other words, write the help message for your program and get the entire parser generated for free! (Source Generators / Console / CLI)
- awsome-dotnet - Docopt - Command-line interface description language that will make you smile. (CLI)
- awesome-dotnet - Docopt - Command-line interface description language that will make you smile. (CLI)
README
# **docopt.net** is a .NET implementation of [docopt]
**docopt.net** is a parser for command-line arguments. It automatically derives
the parsing logic from the help text of a program containing its command-line
usage in [docopt] format. [docopt] is the formalization of conventions that have
been used for decades in help messages and man pages for describing a program's
interface. Below is an example of such a help text containing the usage for a
hypothetical program called Naval Fate:Naval Fate.
Usage:
naval_fate.exe ship new ...
naval_fate.exe ship move [--speed=]
naval_fate.exe ship shoot
naval_fate.exe mine (set|remove) [--moored | --drifting]
naval_fate.exe (-h | --help)
naval_fate.exe --versionOptions:
-h --help Show this screen.
--version Show version.
--speed= Speed in knots [default: 10].
--moored Moored (anchored) mine.
--drifting Drifting mine.## Usage
The following C# example shows one basic way to use **docopt.net**:
```c#
#nullable enableusing System;
using DocoptNet;const string usage = @"Naval Fate.
Usage:
naval_fate.exe ship new ...
naval_fate.exe ship move [--speed=]
naval_fate.exe ship shoot
naval_fate.exe mine (set|remove) [--moored | --drifting]
naval_fate.exe (-h | --help)
naval_fate.exe --versionOptions:
-h --help Show this screen.
--version Show version.
--speed= Speed in knots [default: 10].
--moored Moored (anchored) mine.
--drifting Drifting mine.";
var arguments = new Docopt().Apply(usage, args, version: "Naval Fate 2.0", exit: true)!;
foreach (var (key, value) in arguments)
Console.WriteLine("{0} = {1}", key, value);
```See the [documentation] for more examples and uses of the **docopt.net** API.
## Documentation
The documentation can be found online at .
## Installation
Install [the package][nupkg] in a .NET project using:
dotnet add package docopt.net
## Copyright and License
- © 2012-2014 Vladimir Keleshev
- © 2013 Dinh Doan Van Bien
- © 2021 Atif Aziz
- Portions © .NET Foundation and Contributors
- Portions © West Wind Technologies, 2008Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.[docopt]: http://docopt.org/
[nupkg]: https://www.nuget.org/packages/docopt.net
[documentation]: https://docopt.github.io/docopt.net/