Amélioration des commandes et de l'aide CLI#1
Conversation
- Ajout de la commande principale `ListCommand` pour les opérations de liste. - Enrichissement des commandes `GreetCommand`, `AddCommand` et `ListFilesCommand` avec une option d'aide détaillée (`--help` ou `-h`). - Refonte de la gestion de l'aide globale dans `CliApplication` avec les méthodes `ShowHelp` et `ShowCommandHelp`. - Réorganisation des sous-commandes dans `Program.cs` pour une meilleure hiérarchie. - Ajout de métadonnées dans les fichiers `.csproj` pour générer des packages NuGet avec des informations supplémentaires. - Amélioration de la validation des commandes et des messages d'erreur pour une meilleure expérience utilisateur.
There was a problem hiding this comment.
Pull request overview
This PR introduces typed generic support for CLI arguments and options, along with an automatic help generation system. Key improvements include a fluent CommandBuilder API for configuring commands, type-safe argument/option access methods, and automatic --help/-h handling without manual implementation.
- Adds generic methods (
AddOption<T>(),AddArgument<T>(),GetOption<T>(), etc.) for type-safe CLI configuration - Implements automatic help generation based on command metadata with opt-out support via
DisableHelp - Introduces
CommandBuilderfor fluent command configuration andArgumentDefinitionfor positional parameters
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 19 comments.
Show a summary per file
| File | Description |
|---|---|
| src/CliCoreKit.Hosting/CommandBuilder.cs | New fluent builder class for configuring commands with typed arguments and options |
| src/CliCoreKit.Hosting/CliHostBuilder.cs | Updated return types to CommandBuilder for fluent API support |
| src/CliCoreKit.Core/ParsedArguments.cs | Added generic getter methods with automatic type conversion |
| src/CliCoreKit.Core/CommandDefinition.cs | Added Arguments list and DisableHelp property |
| src/CliCoreKit.Core/ArgumentDefinition.cs | New class defining positional argument metadata |
| src/CliCoreKit.Core/CliApplication.cs | Refactored help system with automatic generation and improved formatting |
| src/CliCoreKit.Core/CliCoreKit.Core.csproj | Version bump to 1.1.0 |
| src/CliCoreKit.Hosting/CliCoreKit.Hosting.csproj | Version bump to 1.1.0 with minor formatting changes |
| samples/CliCoreKit.Sample/Program.cs | Updated to demonstrate new typed API and automatic help |
| samples/CliCoreKit.Sample/CliCoreKit.Sample.csproj | Added IsPackable flag to prevent NuGet packaging |
| tests/CliCoreKit.Core.Tests/ParsedArgumentsGenericTests.cs | Comprehensive tests for generic argument/option methods |
| tests/CliCoreKit.Core.Tests/AutoHelpTests.cs | Tests for automatic help system functionality |
| docs/TypedArguments.md | New documentation for typed arguments feature |
| docs/AutomaticHelp.md | New documentation for automatic help system |
| CHANGELOG.md | New changelog documenting version 1.1.0 changes |
| .claude/settings.local.json | Configuration file for Claude AI permissions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
| and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
|
||
| ## [1.1.0] - 2025-01-XX |
There was a problem hiding this comment.
The release dates are placeholders with "2025-01-XX" format. Before release, these should be updated with the actual release date.
| registry.Register(definition); | ||
|
|
||
| var app = new CliApplication(registry); | ||
| var output = new StringWriter(); |
There was a problem hiding this comment.
Disposable 'StringWriter' is created but not disposed.
| registry.Register(definition); | ||
|
|
||
| var app = new CliApplication(registry); | ||
| var output = new StringWriter(); |
There was a problem hiding this comment.
Disposable 'StringWriter' is created but not disposed.
| registry.Register(definition); | ||
|
|
||
| var app = new CliApplication(registry); | ||
| var output = new StringWriter(); |
There was a problem hiding this comment.
Disposable 'StringWriter' is created but not disposed.
| }); | ||
|
|
||
| var app = new CliApplication(registry); | ||
| var output = new StringWriter(); |
There was a problem hiding this comment.
Disposable 'StringWriter' is created but not disposed.
| }); | ||
|
|
||
| var app = new CliApplication(registry); | ||
| var output = new StringWriter(); |
There was a problem hiding this comment.
Disposable 'StringWriter' is created but not disposed.
ListCommandpour les opérations de liste.GreetCommand,AddCommandetListFilesCommandavec une option d'aide détaillée (--helpou-h).CliApplicationavec les méthodesShowHelpetShowCommandHelp.Program.cspour une meilleure hiérarchie..csprojpour générer des packages NuGet avec des informations supplémentaires.