-
Notifications
You must be signed in to change notification settings - Fork 0
Amélioration des commandes et de l'aide CLI #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
CHANGELOG.md
Outdated
| 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 |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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(); |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disposable 'StringWriter' is created but not disposed.
| registry.Register(definition); | ||
|
|
||
| var app = new CliApplication(registry); | ||
| var output = new StringWriter(); |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disposable 'StringWriter' is created but not disposed.
| registry.Register(definition); | ||
|
|
||
| var app = new CliApplication(registry); | ||
| var output = new StringWriter(); |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disposable 'StringWriter' is created but not disposed.
| }); | ||
|
|
||
| var app = new CliApplication(registry); | ||
| var output = new StringWriter(); |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disposable 'StringWriter' is created but not disposed.
| }); | ||
|
|
||
| var app = new CliApplication(registry); | ||
| var output = new StringWriter(); |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.