Skip to content

Commit f7b2993

Browse files
committed
new api
1 parent 87e3d2b commit f7b2993

File tree

277 files changed

+11807
-7087
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

277 files changed

+11807
-7087
lines changed
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Dev release
1+
name: Dev build
22

33
on:
44
push:
@@ -24,11 +24,7 @@ jobs:
2424
run: dotnet test --no-restore --collect:"XPlat Code Coverage"
2525
- name: Set build label
2626
run: echo "DEVLABEL=$(date +'%Y%m%d')" >> $GITHUB_ENV
27-
- name: Build analyzers
28-
run: dotnet build src/analyzers/ -c Release --no-restore -o analyzers
2927
- name: Build source generator
30-
run: dotnet build src/source-generator/ -c Release --no-restore -o analyzers
28+
run: dotnet build src/generator/ -c Release --no-restore -o analyzers
3129
- name: Pack core library
32-
run: dotnet pack src/lib -c Release --no-restore -p:VersionSuffix=dev.${{ env.DEVLABEL }}.${{ github.run_number }} -o ./pack
33-
- name: Publish packages to NuGet
34-
run: dotnet nuget push ./pack/*[^.symbols].nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_ORG_PUSH_KEY }}
30+
run: dotnet build src/lib -c Release --no-restore

.gitignore

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ FodyWeavers.xsd
402402

403403
# JetBrains Rider
404404
*.sln.iml
405-
.idea
405+
.idea/
406406

407407
##
408408
## Visual studio for Mac
@@ -426,7 +426,7 @@ test-results/
426426
*.dmg
427427
*.app
428428

429-
# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
429+
# content below from: https://github.com/github/gitignore/blob/main/Global/macOS.gitignore
430430
# General
431431
.DS_Store
432432
.AppleDouble
@@ -455,7 +455,7 @@ Network Trash Folder
455455
Temporary Items
456456
.apdisk
457457

458-
# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
458+
# content below from: https://github.com/github/gitignore/blob/main/Global/Windows.gitignore
459459
# Windows thumbnail cache files
460460
Thumbs.db
461461
ehthumbs.db
@@ -482,6 +482,3 @@ $RECYCLE.BIN/
482482

483483
# Vim temporary swap files
484484
*.swp
485-
486-
# Verify artifacts
487-
*.received.*

LICENSE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1717
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1818
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919
SOFTWARE.
20-

README.md

Lines changed: 19 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,30 @@
11
# vertical-cli
22

3-
Minimal, AOT friendly command line arguments parser.
3+
Fully featured command line argument parsing library.
44

5-
## Quick start
6-
7-
### Install
8-
9-
```shell
10-
dotnet add package vertical-cli --prerelease
11-
```
12-
### Configure and run
13-
14-
```csharp
15-
// Define a model
16-
public record ZipOptions(FileInfo Source, FileInfo Destination, bool Overwrite);
17-
18-
// Build an application with two commands
19-
var app = new CliApplicationBuilder("gzip")
20-
.RouteAsync<ZipOptions>("gzip create", async (model, cancelToken) => {
21-
if (model.Destination.Exists && !model.Overwrite){
22-
Console.WriteLine("Target file already exists");
23-
return -1;
24-
}
25-
await using var inputStream = File.OpenRead(model.Source);
26-
await using var outputStream = File.OpenWrite(model.Destination);
27-
await using var zipStream = new GZipStream(outputStream, CompressionMode.Compress);
28-
await inputStream.CopyToAsync(zipStream, cancelToken);
5+
## Features
296

30-
Console.WriteLine($"Compressed file {model.Destination} created.");
31-
})
32-
.RouteAsync<ZipOptions>("gzip extract", async (model, cancelToken) => {
33-
if (model.Destination.Exists && !model.Overwrite){
34-
Console.WriteLine("Target file already exists");
35-
return -1;
36-
}
37-
await using var inputStream = File.OpenRead(model.Source);
38-
await using var outputStream = File.OpenWrite(model.Destination);
39-
await using var zipStream = new GZipStream(inputStream, CompressionMode.Decompress);
40-
await zipStream.CopyToAsync(outputStream, cancelToken);
7+
- Built for complex CLI applications
8+
- Converts string arguments to types
9+
- Supports command hierachies
10+
- Binds arguments to any `IParsable<T>` and their `Nullable<T>` compliments, enums, strings, collections, and more
11+
- Leverages a source generator for a reflection free, AOT-trimmable application
12+
- Integrates a fully customizable help system
13+
- Supports response files and directives
14+
- Extensible with other add-ons
4115

42-
Console.WriteLine($"File {model.Source} extracted.");
43-
})
44-
.MapModel<ZipOptions>(map => map
45-
.Argument(x => x.Source)
46-
.Argument(x => x.Destination)
47-
.Switch(x => x.Overwrite, ["--overwrite"]))
48-
.Build();
16+
## Installation
4917

50-
await app.InvokeAsync(args);
18+
Add the package to your application
5119

52-
// Run:
53-
// $ gzip picture.png picture.gz --overwrite
20+
```bash
21+
> dotnet add package vertical-cli --prerelease
5422
```
5523

56-
## Features
24+
## Documentation
5725

58-
- Binds command line arguments to strongly typed models
59-
- Configure positional arguments. options and switches using short and long form notations
60-
- Define a hierarchy of commands each with derived models
61-
- Uses a source generator to bind models removing the need for reflection (AOT friendly)
62-
- Uses analyzers to provide wranings and errors for common misconfiguration issues
63-
- Display generated help content
26+
- [Conceptual overview](https://github.com/verticalsoftware/vertical-cli/blob/main/docs/home.md)
27+
- [Configuration](https://github.com/verticalsoftware/vertical-cli/blob/main/docs/symbols.md)
28+
- [Advanced concepts](https://github.com/verticalsoftware/vertical-cli/blob/main/docs/models.md)
29+
- [Middleware](https://github.com/verticalsoftware/vertical-cli/blob/main/docs/middleware.md)
6430

65-
See full [docs](https://github.com/verticalsoftware/vertical-cli/blob/main/assets/docs.md).

0 commit comments

Comments
 (0)