diff --git a/README.md b/README.md index 03096594c..086db9424 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# RSCG - 247 Examples of Roslyn Source Code Generators / 16 created by Microsoft / +# RSCG - 248 Examples of Roslyn Source Code Generators / 16 created by Microsoft / -The RSCG_Examples repository is a comprehensive documentation system that automatically processes and showcases 247 Roslyn Source Code Generator (RSCG) examples. The system transforms individual RSCG projects into structured documentation with code examples and cross-referenced content with a searchable website and code example exports. +The RSCG_Examples repository is a comprehensive documentation system that automatically processes and showcases 248 Roslyn Source Code Generator (RSCG) examples. The system transforms individual RSCG projects into structured documentation with code examples and cross-referenced content with a searchable website and code example exports. This system serves as both a learning resource for .NET developers interested in source generators and an automated pipeline for maintaining up-to-date documentation about the RSCG ecosystem -## Latest Update : 2025-12-14 => 14 December 2025 +## Latest Update : 2025-12-15 => 15 December 2025 If you want to see examples with code, please click ***[List V2](https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG)*** @@ -24,8 +24,32 @@ If you want to be notified each time I add a new RSCG example , please click htt ## Content -Those are the 247 Roslyn Source Code Generators that I have tested you can see and download source code example. +Those are the 248 Roslyn Source Code Generators that I have tested you can see and download source code example. ( including 16 from Microsoft ) +### 248. [docopt.net](https://ignatandrei.github.io/RSCG_Examples/v2/docs/docopt.net) , in the [CommandLine](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#commandline) category + +Generated on : 2025-12-15 => 15 December 2025 + +
+ Expand + + + +Author: Atif Aziz + +docopt.net is the .net version of the docopt python beautiful command line parser. docopt.net helps you define an interface for your command-line app, and automatically generate a parser for it. docopt.net is based on conventions that have been used for decades in help messages and man pages for program interface description. Interface description in docopt.net is such a help message, but formalized. Check out http://docopt.org for a more detailed explanation. + Quick example: var arguments = new DocOpt().Apply("Usage: prog [-a] [-b] FILE", args); if (arguments["-a"].IsTrue) { ... } + } + +Nuget: [https://www.nuget.org/packages/docopt.net/](https://www.nuget.org/packages/docopt.net/) + + +Link: [https://ignatandrei.github.io/RSCG_Examples/v2/docs/docopt.net](https://ignatandrei.github.io/RSCG_Examples/v2/docs/docopt.net) + +Source: [https://github.com/docopt/docopt.net](https://github.com/docopt/docopt.net) + +
+ ### 247. [BlazorOcticons](https://ignatandrei.github.io/RSCG_Examples/v2/docs/BlazorOcticons) , in the [Blazor](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#blazor) category Generated on : 2025-12-14 => 14 December 2025 diff --git a/later.md b/later.md index c222c618b..08dde32dd 100644 --- a/later.md +++ b/later.md @@ -1,6 +1,6 @@ # Just later -## Latest Update : 2025-12-14 => 14 December 2025 +## Latest Update : 2025-12-15 => 15 December 2025 diff --git a/v2/.tours/docopt.net.tour b/v2/.tours/docopt.net.tour new file mode 100644 index 000000000..2eb4ce531 --- /dev/null +++ b/v2/.tours/docopt.net.tour @@ -0,0 +1,36 @@ + +{ + "$schema": "https://aka.ms/codetour-schema", + "title": "docopt.net", + "steps": + [ + { + "file": "rscg_examples/docopt.net/src/ConsoleArgs/ConsoleArgs.csproj", + "description": "First, we add Nuget [docopt.net](https://www.nuget.org/packages/docopt.net/) in csproj ", + "pattern": "docopt.net" + } + + ,{ + "file": "rscg_examples/docopt.net/src/ConsoleArgs/Program.docopt.txt", + "description": "File Program.docopt.txt ", + "pattern": "this is the code" + } + + ,{ + "file": "rscg_examples/docopt.net/src/ConsoleArgs/Program.cs", + "description": "File Program.cs \r\n>> dotnet run --project rscg_examples/docopt.net/src/ConsoleArgs/ConsoleArgs.csproj ", + "pattern": "this is the code" + } + + + ,{ + "file": "rscg_examples/docopt.net/src/ConsoleArgs/obj/GX/DocoptNet/DocoptNet.CodeGeneration.SourceGenerator/ConsoleArgs.ProgramArguments.cs", + "description": "Generated File 1 from 1 : ConsoleArgs.ProgramArguments.cs ", + "line": 1 + } + + ], + + "ref": "main" + +} \ No newline at end of file diff --git a/v2/Generator/all.csv b/v2/Generator/all.csv index ac974e579..3cf20b6aa 100644 --- a/v2/Generator/all.csv +++ b/v2/Generator/all.csv @@ -246,3 +246,4 @@ Nr,Key,Source,Category 245,Monify, https://github.com/MooVC/monify,PrimitiveObsession 246,Imposter, https://github.com/themidnightgospel/Imposter,Tests 247,BlazorOcticons, https://github.com/BlazorOcticons/BlazorOcticons,Blazor +248,docopt.net, https://github.com/docopt/docopt.net,CommandLine diff --git a/v2/RSCGExamplesData/GeneratorDataRec.json b/v2/RSCGExamplesData/GeneratorDataRec.json index cfe827716..51ef09651 100644 --- a/v2/RSCGExamplesData/GeneratorDataRec.json +++ b/v2/RSCGExamplesData/GeneratorDataRec.json @@ -1497,5 +1497,11 @@ "Category": 21, "dtStart": "2025-12-14T00:00:00", "show": true + }, + { + "ID": "docopt.net", + "Category": 32, + "dtStart": "2025-12-15T00:00:00", + "show": true } ] \ No newline at end of file diff --git a/v2/book/examples/docopt.net.html b/v2/book/examples/docopt.net.html new file mode 100644 index 000000000..4a453aa24 --- /dev/null +++ b/v2/book/examples/docopt.net.html @@ -0,0 +1,59 @@ + +

RSCG nr 248 : docopt.net

+ +

Info

+Nuget : https://www.nuget.org/packages/docopt.net/ + +

You can find more details at : https://github.com/docopt/docopt.net

+ +

Author :Atif Aziz

+ +

Source: https://github.com/docopt/docopt.net

+ +

About

+ +Generating command line argument parsers from usage documentation. + +

+ How to use +

+

+ Add reference to the docopt.net in the csproj +

+ + +

This was for me the starting code

+ +
+ I have coded the file Program.cs +
+ +
+ +
+ I have coded the file Program.docopt.txt +
+ +
+

And here are the generated files

+ +
+ The file generated is ConsoleArgs.ProgramArguments.cs +
+ + +

+ You can download the code and this page as pdf from + + https://ignatandrei.github.io/RSCG_Examples/v2/docs/docopt.net + +

+ + +

+ You can see the whole list at + + https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG + +

+ diff --git a/v2/book/list.html b/v2/book/list.html index 6ffb319b3..b7307e7ce 100644 --- a/v2/book/list.html +++ b/v2/book/list.html @@ -17,7 +17,7 @@

-This is the list of 247 RSCG with examples => +This is the list of 248 RSCG with examples =>

@@ -1014,6 +1014,10 @@

+ + + +
247 BlazorOcticons
248docopt.net
diff --git a/v2/book/pandocHTML.yaml b/v2/book/pandocHTML.yaml index 81b3f4601..36dd96b61 100644 --- a/v2/book/pandocHTML.yaml +++ b/v2/book/pandocHTML.yaml @@ -261,6 +261,7 @@ input-files: - examples/Monify.html - examples/Imposter.html - examples/BlazorOcticons.html +- examples/docopt.net.html # or you may use input-file: with a single value # defaults: diff --git a/v2/rscg_examples/docopt.net/description.json b/v2/rscg_examples/docopt.net/description.json new file mode 100644 index 000000000..aaaa70521 --- /dev/null +++ b/v2/rscg_examples/docopt.net/description.json @@ -0,0 +1,22 @@ +{ + "generator":{ + "name":"docopt.net", + "nuget":[ + "https://www.nuget.org/packages/docopt.net/" + ], + "link":"https://github.com/docopt/docopt.net", + "author":"Atif Aziz", + "source":"https://github.com/docopt/docopt.net" + }, + "data":{ + "goodFor":["Generating command line argument parsers from usage documentation."], + "csprojDemo":"ConsoleArgs.csproj", + "csFiles":["Program.cs","Program.docopt.txt"], + "excludeDirectoryGenerated":[""], + "includeAdditionalFiles":[""] + }, + "links":{ + "blog":"", + "video":"" + } +} \ No newline at end of file diff --git a/v2/rscg_examples/docopt.net/nuget.txt b/v2/rscg_examples/docopt.net/nuget.txt new file mode 100644 index 000000000..e5a78204d --- /dev/null +++ b/v2/rscg_examples/docopt.net/nuget.txt @@ -0,0 +1,3 @@ +docopt.net is the .net version of the docopt python beautiful command line parser. docopt.net helps you define an interface for your command-line app, and automatically generate a parser for it. docopt.net is based on conventions that have been used for decades in help messages and man pages for program interface description. Interface description in docopt.net is such a help message, but formalized. Check out http://docopt.org for a more detailed explanation. + Quick example: var arguments = new DocOpt().Apply("Usage: prog [-a] [-b] FILE", args); if (arguments["-a"].IsTrue) { ... } + } \ No newline at end of file diff --git a/v2/rscg_examples/docopt.net/readme.txt b/v2/rscg_examples/docopt.net/readme.txt new file mode 100644 index 000000000..2b2e99bb8 --- /dev/null +++ b/v2/rscg_examples/docopt.net/readme.txt @@ -0,0 +1,101 @@ +# **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 --version + + Options: + -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 enable + +using 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 --version + +Options: + -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, 2008 + +Permission 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/ diff --git a/v2/rscg_examples/docopt.net/src/ConsoleArgs.slnx b/v2/rscg_examples/docopt.net/src/ConsoleArgs.slnx new file mode 100644 index 000000000..698786cb5 --- /dev/null +++ b/v2/rscg_examples/docopt.net/src/ConsoleArgs.slnx @@ -0,0 +1,3 @@ + + + diff --git a/v2/rscg_examples/docopt.net/src/ConsoleArgs/ConsoleArgs.csproj b/v2/rscg_examples/docopt.net/src/ConsoleArgs/ConsoleArgs.csproj new file mode 100644 index 000000000..821b81882 --- /dev/null +++ b/v2/rscg_examples/docopt.net/src/ConsoleArgs/ConsoleArgs.csproj @@ -0,0 +1,17 @@ + + + + Exe + net10.0 + enable + enable + + + + + + + true + $(BaseIntermediateOutputPath)\GX + + diff --git a/v2/rscg_examples/docopt.net/src/ConsoleArgs/Program.cs b/v2/rscg_examples/docopt.net/src/ConsoleArgs/Program.cs new file mode 100644 index 000000000..37f194225 --- /dev/null +++ b/v2/rscg_examples/docopt.net/src/ConsoleArgs/Program.cs @@ -0,0 +1,2 @@ +//Console.WriteLine(ConsoleArgs.ProgramArguments.Help); +Console.WriteLine(ConsoleArgs.ProgramArguments.Usage); \ No newline at end of file diff --git a/v2/rscg_examples/docopt.net/src/ConsoleArgs/Program.docopt.txt b/v2/rscg_examples/docopt.net/src/ConsoleArgs/Program.docopt.txt new file mode 100644 index 000000000..2dcca7bbb --- /dev/null +++ b/v2/rscg_examples/docopt.net/src/ConsoleArgs/Program.docopt.txt @@ -0,0 +1,12 @@ +Array 2 Any + +Usage: + array_2_any.exe translate + array_2_any.exe translatefile + array_2_any.exe (-h | --help) + array_2_any.exe --version + +Options: + -h --help Show this screen. + --version Show version. + --verbose Show more output. \ No newline at end of file diff --git a/v2/rscg_examples/docopt.net/video.json b/v2/rscg_examples/docopt.net/video.json new file mode 100644 index 000000000..9f9c259ff --- /dev/null +++ b/v2/rscg_examples/docopt.net/video.json @@ -0,0 +1,39 @@ +{ + "scriptName": "docopt.net", + "steps": +[ + {"typeStep":"exec","arg":"clipchamp.exe launch"}, + {"typeStep":"text","arg": "Welcome to Roslyn Examples"}, + {"typeStep":"text","arg":"If you want to see more examples , see List Of RSCG"}, + {"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG"}, + {"typeStep":"text","arg": "My name is Andrei Ignat and I am deeply fond of Roslyn Source Code Generator. "}, + +{"typeStep":"text","arg": "Today I will present docopt.net . Generating command line argument parsers from usage documentation. ."}, +{"typeStep":"browser","arg":"https://www.nuget.org/packages/docopt.net/"}, +{"typeStep":"text","arg": "The whole example is here"}, +{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/docopt.net"}, +{"typeStep":"text","arg": "You can download the code from here"}, +{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/docopt.net#download-example-net--c-"}, +{"typeStep":"text","arg":"Here is the code downloaded "}, +{"typeStep":"exec","arg":"explorer.exe /select,D:\\gth\\RSCG_Examples\\v2\\Generator.sln"}, +{"typeStep":"text","arg": "So , let's start the project with Visual Studio Code "}, +{"typeStep":"stepvscode","arg": "-n D:\\gth\\RSCG_Examples\\v2"}, + +{"typeStep":"text","arg": "To use it ,you will put the Nuget docopt.net into the csproj "}, + +{"typeStep":"stepvscode","arg": "-r -g D:\\gth\\RSCG_Examples\\v2\\rscg_examples\\docopt.net\\src\\ConsoleArgs\\ConsoleArgs.csproj"}, + +{"typeStep":"text","arg": "And now I will show you an example of using docopt.net"}, + +{"typeStep":"hide","arg": "now execute the tour in VSCode"}, +{"typeStep":"tour", "arg": "src/.tours/"}, +{"typeStep":"text","arg":" And I will execute the project"}, +{"typeStep":"showproj", "arg":"ConsoleArgs.csproj"}, +{"typeStep":"text","arg":" This concludes the project"}, +{"typeStep":"waitseconds","arg":"30"}, +{"typeStep":"text","arg": "Remember, you can download the code from here"}, +{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/docopt.net#download-example-net--c-", +SpeakTest=" "}, +{"typeStep":"waitseconds","arg":"30"}, +] +} diff --git a/v2/rscg_examples_site/docs/Authors/Atif_Aziz.md b/v2/rscg_examples_site/docs/Authors/Atif_Aziz.md new file mode 100644 index 000000000..eccbcf541 --- /dev/null +++ b/v2/rscg_examples_site/docs/Authors/Atif_Aziz.md @@ -0,0 +1,7 @@ +# Author : Atif Aziz + +Number RSCG: 1 + + + 1 [docopt.net](/docs/docopt.net) [![Nuget](https://img.shields.io/nuget/dt/docopt.net?label=docopt.net)](https://www.nuget.org/packages/docopt.net/) ![GitHub Repo stars](https://img.shields.io/github/stars/docopt/docopt.net?style=social) 2025-12-15 + diff --git a/v2/rscg_examples_site/docs/Categories/CommandLine.md b/v2/rscg_examples_site/docs/Categories/CommandLine.md index f74acdd77..009c182ef 100644 --- a/v2/rscg_examples_site/docs/Categories/CommandLine.md +++ b/v2/rscg_examples_site/docs/Categories/CommandLine.md @@ -1,6 +1,6 @@

CommandLine

-Number RSCG: 4 +Number RSCG: 5 1 [ArgumentParsing](/docs/ArgumentParsing) [![Nuget](https://img.shields.io/nuget/dt/ArgumentParsing?label=ArgumentParsing)](https://www.nuget.org/packages/ArgumentParsing/) ![GitHub Repo stars](https://img.shields.io/github/stars/DoctorKrolic/ArgumentParsing?style=social) 2025-07-01 @@ -8,5 +8,7 @@ Number RSCG: 4 3 [ConsoleAppFramework](/docs/ConsoleAppFramework) [![Nuget](https://img.shields.io/nuget/dt/ConsoleAppFramework?label=ConsoleAppFramework)](https://www.nuget.org/packages/ConsoleAppFramework/) ![GitHub Repo stars](https://img.shields.io/github/stars/Cysharp/ConsoleAppFramework?style=social) 2025-10-02 - 4 [TeCLI](/docs/TeCLI) [![Nuget](https://img.shields.io/nuget/dt/TeCLI?label=TeCLI)](https://www.nuget.org/packages/TeCLI/) ![GitHub Repo stars](https://img.shields.io/github/stars/tyevco/TeCLI?style=social) 2025-11-07 + 4 [docopt.net](/docs/docopt.net) [![Nuget](https://img.shields.io/nuget/dt/docopt.net?label=docopt.net)](https://www.nuget.org/packages/docopt.net/) ![GitHub Repo stars](https://img.shields.io/github/stars/docopt/docopt.net?style=social) 2025-12-15 + + 5 [TeCLI](/docs/TeCLI) [![Nuget](https://img.shields.io/nuget/dt/TeCLI?label=TeCLI)](https://www.nuget.org/packages/TeCLI/) ![GitHub Repo stars](https://img.shields.io/github/stars/tyevco/TeCLI?style=social) 2025-11-07 \ No newline at end of file diff --git a/v2/rscg_examples_site/docs/Categories/_PrimitiveCommandLine.mdx b/v2/rscg_examples_site/docs/Categories/_PrimitiveCommandLine.mdx index 9e92243eb..e0120b5d9 100644 --- a/v2/rscg_examples_site/docs/Categories/_PrimitiveCommandLine.mdx +++ b/v2/rscg_examples_site/docs/Categories/_PrimitiveCommandLine.mdx @@ -6,7 +6,9 @@ 3 [ConsoleAppFramework](/docs/ConsoleAppFramework) [![Nuget](https://img.shields.io/nuget/dt/ConsoleAppFramework?label=ConsoleAppFramework)](https://www.nuget.org/packages/ConsoleAppFramework/) ![GitHub Repo stars](https://img.shields.io/github/stars/Cysharp/ConsoleAppFramework?style=social) 2025-10-02 - 4 [TeCLI](/docs/TeCLI) [![Nuget](https://img.shields.io/nuget/dt/TeCLI?label=TeCLI)](https://www.nuget.org/packages/TeCLI/) ![GitHub Repo stars](https://img.shields.io/github/stars/tyevco/TeCLI?style=social) 2025-11-07 + 4 [docopt.net](/docs/docopt.net) [![Nuget](https://img.shields.io/nuget/dt/docopt.net?label=docopt.net)](https://www.nuget.org/packages/docopt.net/) ![GitHub Repo stars](https://img.shields.io/github/stars/docopt/docopt.net?style=social) 2025-12-15 + + 5 [TeCLI](/docs/TeCLI) [![Nuget](https://img.shields.io/nuget/dt/TeCLI?label=TeCLI)](https://www.nuget.org/packages/TeCLI/) ![GitHub Repo stars](https://img.shields.io/github/stars/tyevco/TeCLI?style=social) 2025-11-07 ### See category diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/docopt.net.md b/v2/rscg_examples_site/docs/RSCG-Examples/docopt.net.md new file mode 100644 index 000000000..a9fb6e0a9 --- /dev/null +++ b/v2/rscg_examples_site/docs/RSCG-Examples/docopt.net.md @@ -0,0 +1,502 @@ +--- +sidebar_position: 2480 +title: 248 - docopt.net +description: Generating command line argument parsers from usage documentation. +slug: /docopt.net +--- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; +import TOCInline from '@theme/TOCInline'; +import SameCategory from '../Categories/_PrimitiveCommandLine.mdx'; + +# docopt.net by Atif Aziz + + + + +## NuGet / site data +[![Nuget](https://img.shields.io/nuget/dt/docopt.net?label=docopt.net)](https://www.nuget.org/packages/docopt.net/) +[![GitHub last commit](https://img.shields.io/github/last-commit/docopt/docopt.net?label=updated)](https://github.com/docopt/docopt.net) +![GitHub Repo stars](https://img.shields.io/github/stars/docopt/docopt.net?style=social) + +## Details + +### Info +:::info + +Name: **docopt.net** + +docopt.net is the .net version of the docopt python beautiful command line parser. docopt.net helps you define an interface for your command-line app, and automatically generate a parser for it. docopt.net is based on conventions that have been used for decades in help messages and man pages for program interface description. Interface description in docopt.net is such a help message, but formalized. Check out http://docopt.org for a more detailed explanation. + Quick example: var arguments = new DocOpt().Apply("Usage: prog [-a] [-b] FILE", args); if (arguments["-a"].IsTrue) \{ ... } + } + +Author: Atif Aziz + +NuGet: +*https://www.nuget.org/packages/docopt.net/* + + +You can find more details at https://github.com/docopt/docopt.net + +Source: https://github.com/docopt/docopt.net + +::: + +### Author +:::note +Atif Aziz +![Alt text](https://github.com/docopt.png) +::: + +### Original Readme +:::note + +# **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 --version + + Options: + -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 enable + +using 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 --version + +Options: + -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 https://docopt.github.io/docopt.net/. + +## Installation + +Install [the package][nupkg] in a .NET project using: + + dotnet add package docopt.net + +## Copyright and License + +- © 2012-2014 Vladimir Keleshev vladimir@keleshev.com +- © 2013 Dinh Doan Van Bien dinh@doanvanbien.com +- © 2021 Atif Aziz +- Portions © .NET Foundation and Contributors +- Portions © West Wind Technologies, 2008 + +Permission 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/ + + +::: + +### About +:::note + +Generating command line argument parsers from usage documentation. + + +::: + +## How to use + +### Example (source csproj, source files) + + + + + +This is the CSharp Project that references **docopt.net** +```xml showLineNumbers {11} + + + + Exe + net10.0 + enable + enable + + + + + + + true + $(BaseIntermediateOutputPath)\GX + + + +``` + + + + + + This is the use of **docopt.net** in *Program.cs* + +```csharp showLineNumbers +//Console.WriteLine(ConsoleArgs.ProgramArguments.Help); +Console.WriteLine(ConsoleArgs.ProgramArguments.Usage); +``` + + + + + This is the use of **docopt.net** in *Program.docopt.txt* + +```csharp showLineNumbers +Array 2 Any + +Usage: + array_2_any.exe translate + array_2_any.exe translatefile + array_2_any.exe (-h | --help) + array_2_any.exe --version + +Options: + -h --help Show this screen. + --version Show version. + --verbose Show more output. +``` + + + + +### Generated Files + +Those are taken from $(BaseIntermediateOutputPath)\GX + + + + +```csharp showLineNumbers +#nullable enable annotations + +using System.Collections; +using System.Collections.Generic; +using DocoptNet; +using DocoptNet.Internals; +using Leaves = DocoptNet.Internals.ReadOnlyList; + +namespace ConsoleArgs +{ + partial class ProgramArguments : IEnumerable> + { + public const string Help = @"Array 2 Any + +Usage: + array_2_any.exe translate + array_2_any.exe translatefile + array_2_any.exe (-h | --help) + array_2_any.exe --version + +Options: + -h --help Show this screen. + --version Show version. + --verbose Show more output."; + + public const string Usage = @"Usage: + array_2_any.exe translate + array_2_any.exe translatefile + array_2_any.exe (-h | --help) + array_2_any.exe --version"; + + static readonly IHelpFeaturingParser Parser = GeneratedSourceModule.CreateParser(Help, Parse).EnableHelp(); + + public static IHelpFeaturingParser CreateParser() => Parser; + + static IParser.IResult Parse(IEnumerable args, ParseFlags flags, string? version) + { + var options = new List + + + +## Useful + +### Download Example (.NET C#) + +:::tip + +[Download Example project docopt.net ](/sources/docopt.net.zip) + +::: + + +### Share docopt.net + + + +https://ignatandrei.github.io/RSCG_Examples/v2/docs/docopt.net + + + diff --git a/v2/rscg_examples_site/docs/RSCG-Examples/index.md b/v2/rscg_examples_site/docs/RSCG-Examples/index.md index 709a948f7..f2cbe063e 100644 --- a/v2/rscg_examples_site/docs/RSCG-Examples/index.md +++ b/v2/rscg_examples_site/docs/RSCG-Examples/index.md @@ -1,7 +1,7 @@ --- sidebar_position: 30 -title: 247 RSCG list by category -description: 247 RSCG list by category +title: 248 RSCG list by category +description: 248 RSCG list by category slug: /rscg-examples --- @@ -275,7 +275,7 @@ import DocCardList from '@theme/DocCardList'; ## CommandLine
- Expand CommandLine =>examples:4 + Expand CommandLine =>examples:5 @@ -296,6 +296,11 @@ import DocCardList from '@theme/DocCardList'; [TeCLI](/docs/TeCLI) + + + +[docopt.net](/docs/docopt.net) +
@@ -1633,6 +1638,8 @@ flowchart LR; CommandLine--> TeCLI((TeCLI)) + CommandLine--> docopt.net((docopt.net)) + Console--> Figgle((Figgle)) Constructor--> AutoDeconstruct((AutoDeconstruct)) diff --git a/v2/rscg_examples_site/docs/about.md b/v2/rscg_examples_site/docs/about.md index ef04c8f99..d726a9f9f 100644 --- a/v2/rscg_examples_site/docs/about.md +++ b/v2/rscg_examples_site/docs/about.md @@ -6,7 +6,7 @@ title: About ## Content You will find here code examples -of 247 Roslyn Source Code Generator (RSCG) +of 248 Roslyn Source Code Generator (RSCG) that can be useful for you. That means, you will write more elegant and concise code - even if the generators code is not always nice to look. ## Are those examples ready for production? diff --git a/v2/rscg_examples_site/docs/indexRSCG.md b/v2/rscg_examples_site/docs/indexRSCG.md index 49b6d38b0..cef5064aa 100644 --- a/v2/rscg_examples_site/docs/indexRSCG.md +++ b/v2/rscg_examples_site/docs/indexRSCG.md @@ -7,9 +7,9 @@ slug: /List-of-RSCG import useBaseUrl from '@docusaurus/useBaseUrl'; -## 247 RSCG with examples in descending chronological order +## 248 RSCG with examples in descending chronological order -This is the list of 247 ( 16 from Microsoft) RSCG with examples +This is the list of 248 ( 16 from Microsoft) RSCG with examples [See by category](/docs/rscg-examples) [See as json](/exports/RSCG.json) [See as Excel](/exports/RSCG.xlsx) @@ -20,6 +20,7 @@ This is the list of 247 ( 16 from Microsoft) RSCG with examples | No | Name | Date | Category | | --------- | ----- | ---- | -------- | +|248| [docopt.net by Atif Aziz ](/docs/docopt.net)|2025-12-15 => 15 December 2025 | [CommandLine](/docs/Categories/CommandLine) | |247| [BlazorOcticons by Evgeniy K. ](/docs/BlazorOcticons)|2025-12-14 => 14 December 2025 | [Blazor](/docs/Categories/Blazor) | |246| [Imposter by Bitchiko Tchelidze ](/docs/Imposter)|2025-12-13 => 13 December 2025 | [Tests](/docs/Categories/Tests) | |245| [Monify by Paul Martin ](/docs/Monify)|2025-12-12 => 12 December 2025 | [PrimitiveObsession](/docs/Categories/PrimitiveObsession) | diff --git a/v2/rscg_examples_site/src/components/HomepageFeatures/index.js b/v2/rscg_examples_site/src/components/HomepageFeatures/index.js index d29ed013a..66d934d0c 100644 --- a/v2/rscg_examples_site/src/components/HomepageFeatures/index.js +++ b/v2/rscg_examples_site/src/components/HomepageFeatures/index.js @@ -4,7 +4,7 @@ import styles from './styles.module.css'; const FeatureList = [ { -title: '247 Examples (16 from MSFT)', +title: '248 Examples (16 from MSFT)', Svg: require('@site/static/img/undraw_docusaurus_mountain.svg').default, description: ( <> diff --git a/v2/rscg_examples_site/static/exports/RSCG.json b/v2/rscg_examples_site/static/exports/RSCG.json index 5f31664e4..2dd135043 100644 --- a/v2/rscg_examples_site/static/exports/RSCG.json +++ b/v2/rscg_examples_site/static/exports/RSCG.json @@ -1977,6 +1977,14 @@ "Source": "https://github.com/BlazorOcticons/BlazorOcticons", "Category": "Blazor", "AddedOn": "2025-12-14T00:00:00" + }, + { + "Name": "docopt.net", + "Link": "https://ignatandrei.github.io/RSCG_Examples/v2/docs/docopt.net", + "NuGet": "https://www.nuget.org/packages/docopt.net/", + "Source": "https://github.com/docopt/docopt.net", + "Category": "CommandLine", + "AddedOn": "2025-12-15T00:00:00" } ] } \ No newline at end of file diff --git a/v2/rscg_examples_site/static/exports/RSCG.xlsx b/v2/rscg_examples_site/static/exports/RSCG.xlsx index dc69d0581..db1cc9f21 100644 Binary files a/v2/rscg_examples_site/static/exports/RSCG.xlsx and b/v2/rscg_examples_site/static/exports/RSCG.xlsx differ diff --git a/v2/rscg_examples_site/static/sources/docopt.net.zip b/v2/rscg_examples_site/static/sources/docopt.net.zip new file mode 100644 index 000000000..2ed8134ef Binary files /dev/null and b/v2/rscg_examples_site/static/sources/docopt.net.zip differ