You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+62-44Lines changed: 62 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,9 +9,9 @@
9
9
[zh-hans]: /docs/zh-hans/README.md
10
10
[zh-hant]: /docs/zh-hant/README.md
11
11
12
-
DotNetCampus.CommandLine is a simple yet high-performance command line parsing library for .NET. Thanks to the power of source code generators, it provides efficient parsing capabilities with a developer-friendly experience.
12
+
DotNetCampus.CommandLine is a simple and high-performance command line parsing library for .NET. Benefiting from source generators (and interceptors), it delivers efficient parsing and a friendly development experience across multiple command line styles. All features live under the `DotNetCampus.Cli` namespace.
13
13
14
-
Parsing a typical command line takes only about 0.8μs (microseconds), making it one of the fastest command line parsers available in .NET.
14
+
Benchmarks show parsing a typical command line takes well under a microsecond in many scenarios, placing it among the fastest .NET command line parsers while still pursuing full‑featured syntax support.
> demo.exe "C:\Users\lvyi\Desktop\demo.txt" -s -Mode Edit -StartupSessions A B C
62
-
```
79
+
## Command Styles and Features
63
80
64
-
### Windows CMD Style
81
+
Multiple command line styles are supported; select one when parsing (Flexible is default). Styles differ in case sensitivity, accepted prefixes, separators, and naming forms. A detailed capability matrix (boolean literals, collection parsing forms, naming conventions, URL form, etc.) is documented in the full English guide under `docs/en/README.md`.
65
82
66
-
```cmd
67
-
> demo.exe "C:\Users\lvyi\Desktop\demo.txt" /s /Mode Edit /StartupSessions A B C
68
-
```
83
+
Core capabilities:
84
+
- Rich option syntax: long & short options; separators `= : space`; multi-value & repeat forms
- Commands & subcommands: multi-word `[Command]` supported with handler chaining or `ICommandHandler`
90
+
- URL protocol parsing: `scheme://command/sub/positional1?...` for integration scenarios
91
+
- High performance: source generators + interceptors, minimizing allocations
92
+
- AOT compatible: no reflection; even enum name lookups are avoided at runtime
69
93
70
-
### Linux/GNU Style
94
+
For the full feature matrix (including whether a style supports space-separated collections, explicit boolean values, multi-char short option groups, etc.), see the English documentation table.
71
95
72
-
```bash
73
-
$ demo.exe "C:/Users/lvyi/Desktop/demo.txt" -s --mode Edit --startup-sessions A --startup-sessions B --startup-sessions C
Define options using kebab-case in attributes (e.g., `[Option("test-name")]`). The analyzer warns (`DCL101`) if not kebab-case; we still treat what you write as kebab-case so users may invoke with PascalCase/camelCase depending on style.
80
99
81
-
## Command Styles and Features
100
+
### Required Options and Default Values
101
+
102
+
Modifiers: `required` (must be supplied), `init` (immutable after construction), `?` (nullable). Initial value semantics follow the table in `docs/en/README.md`: required & missing → exception; nullable + init → null; non-nullable collection → empty; non-nullable scalar → default value (value types) or empty string for `string`; otherwise keep initializer.
103
+
104
+
### Commands and Subcommands
105
+
106
+
Register handlers with `AddHandler<T>()` or implement `ICommandHandler`. Multi-word `[Command("remote add")]` expresses subcommands. Ambiguity throws `CommandNameAmbiguityException`. Use `RunAsync` if any handler is async.
107
+
108
+
### URL Protocol
109
+
110
+
You may express a command invocation as a URL: `dotnet-campus://1.txt/2.txt?count=20&test-name=BenchmarkTest&detail-level=High&debug` enabling shell integration or deep links.
111
+
112
+
### Performance
82
113
83
-
The library supports multiple command line styles through `CommandLineStyle` enum:
- Support for various data types including collections and dictionaries
92
-
- Positional arguments with `ValueAttribute`
93
-
- Required properties with C# `required` modifier
94
-
- Command handling with command support
95
-
- URL protocol parsing
96
-
- High performance thanks to source generators
114
+
Benchmarks (see docs for detailed tables) show very low latency (hundreds of ns typical) and minimal allocations compared to earlier versions and other libraries, while preserving rich syntax coverage.
97
115
98
116
## Engage, Contribute and Provide Feedback
99
117
@@ -107,7 +125,7 @@ Click here to file a new issue:
0 commit comments