Skip to content

Develop#7

Open
eugener wants to merge 43 commits intomainfrom
develop
Open

Develop#7
eugener wants to merge 43 commits intomainfrom
develop

Conversation

@eugener
Copy link
Copy Markdown
Owner

@eugener eugener commented Jun 8, 2025

No description provided.

eugener and others added 30 commits June 6, 2025 08:59
- Support merging config file values with CLI arguments, giving precedence
  to CLI args
- Implement Executor.ExecuteWithConfig and mergeConfigs for config merging
- Refactor examples into subdirectories with go.mod files for each
- Add sample config files for config and simple examples
- Remove obsolete main.go and simple_example.go files
- Introduce `cli` package with a fluent, developer-friendly API for building CLI apps
- Move internal helpers (bind, help, posix, etc.) under `internal/` for encapsulation
- Update imports to use internal packages where appropriate
- Add `examples/fluent-api` to demonstrate the new API
- Remove legacy examples in favor of new, clearer examples and documentation
- Expand and modernize the README with improved quick start, API comparison, and feature overview
- Maintain full backward compatibility with the traditional struct-based approach
- Migrate advanced example to new cli package and command structure
- Add gopkg.in/yaml.v3 as an indirect dependency in go.mod files
- Add go.sum files for dependency tracking
- Update and add example binaries for advanced, config, and interactive demos
- Remove all example binaries from repository
- Add specific executable names to .gitignore
- Prevent future binary commits

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ackages

- Add unit and integration tests for app, cli, core, config, internal/help,
  internal/bind, internal/posix, internal/complete, internal/configfile,
  and internal/interactive packages
- Improve coverage for error paths, middleware, config merging, help
  generation, completion, and interactive prompts
- Update CLAUDE.md with detailed test coverage strategy and next steps
- Allow Bash(go test:*) in Claude settings for test automation
- Fix config type extraction in core/registry.go for correct method signature
- Explicitly ignore non-fatal errors in config loading and arg parsing
- Check Register errors in tests and use assignment to avoid unused warnings
- Remove unused helper functions and fields in tests
- Remove redundant or unused code in core and internal packages
- Simplify pattern validator logic for clarity
- Move flag validation out of POSIX parser for centralized handling
- Run staticcheck only on Ubuntu and use latest version
- Add Go modules cache for faster linting
- Pin golangci-lint to v1.64.8 and skip examples directory
Add mutex locking to Registry methods to ensure safe concurrent
access to the commands map.
Add explicit bash shell to CI workflow steps
- Introduce Scanner interface for input scanning to allow mocking
- Refactor prompter structs to use Scanner instead of *bufio.Scanner
- Add comprehensive unit tests for interactive prompting logic
- Update test configs to use new struct tag format
- Improve coverage for help and interactive packages in coverage table
- Fix validator to handle nil choices correctly
- Introduce cli/output.go with output formatting utilities and types
- Add OutputConfig and formatter helpers to cli package
- Implement internal/output/formatter.go for formatting data
- Add tests for output formatting in cli/output_test.go and internal/output/formatter_test.go
- Expose output format options in config/options.go
- Demonstrate usage in examples/fluent-api and new output-demo example
Table formatting now uses Unicode borders for better readability and
appearance. Updated tests to check for new border characters. Also
marked structured output support as completed in documentation.
Add new progress and spinner utilities to cli package, including
re-exported options and predefined styles. Provide comprehensive tests
and an example app demonstrating usage and integration. Implement
internal UI logic for progress bars and spinners with customizable
appearance and output.
eugener and others added 13 commits June 7, 2025 12:19
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Implement command alias support with fluent API and helpers
- Show aliases in help output and handle alias conflicts
- Add enhanced error messages with suggestions and context
- Improve error formatting for unknown commands, conflicts, and config errors
- Update docs and tests for aliases and error handling
- Improve ordering and comments for error type detection in
  Application.buildErrorContext for clarity and specificity.
- Add formatCommandDisplayName helper to help.Generator for consistent
  command/alias display in help output.
- Add unit tests for formatCommandDisplayName.
- Minor whitespace and formatting cleanups in tests and progress code.
Add command aliases and enhanced error messages
- Replace layered Command/ParentCommand interfaces with a single, type-safe Command interface supporting subcommands
- Remove all redundant code and legacy builder patterns
- Refactor registry and CLI to use unified command system
- Add intelligent error handling: auto-help and colored guidance when parent commands are executed directly
- Update documentation and examples to reflect unified architecture
- Add comprehensive nested command example (Docker/Kubernetes style)
- Update help generator to support parent/subcommand listings
Deduplicate mergeConfigs and validateConfig logic by moving them to
internal/config/utils.go. Update core/executor.go and app/application.go to use
the shared functions. Add comprehensive tests for config utilities. Also,
refactor help generator to reduce code duplication in command listing.
Unify command architecture and enhance parent command help
Copilot AI review requested due to automatic review settings June 8, 2025 22:21

This comment was marked as outdated.

@eugener eugener requested a review from Copilot June 8, 2025 22:30
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 refactors and enhances command resolution, error handling, and configuration loading within the CLI framework while adding new output formatting options and updating tests.

  • Refactored command execution flow and error context generation in the application package.
  • Updated configuration file loading to return a base configuration for merging with CLI arguments.
  • Added output options in the configuration and updated various test cases accordingly.

Reviewed Changes

Copilot reviewed 95 out of 95 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
core/executor.go Replaced validateConfig with external configutils validation and introduced ExecuteWithConfig API.
core/cli.go Improved generic extraction for config types from commands.
config/options.go Added output formatting fields and corresponding option functions.
cli/* Updated progress, spinner, output and error handling with corresponding tests.
app/application.go Refactored command resolution, error handling, configuration loading, and interactive prompting with enhanced error context support.
.github/workflows/ci.yml Added multi-OS Go testing and linting workflows.
.claude/settings.local.json Extended permission settings for new Bash commands.
Comments suppressed due to low confidence (1)

app/application.go:670

  • The TODO about merging the loaded configuration with CLI arguments remains unimplemented. Consider adding a merging strategy (e.g. using configutils.MergeConfigs) to combine file-based configuration with command-line overrides for better consistency.
if err := loader.Load(config); err != nil {

Comment thread app/application.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants