Skip to content

refactor(cmd): restructure command modules and update documentation - #1

Merged
caomengxuan666 merged 5 commits into
mainfrom
develop
Feb 7, 2026
Merged

caomengxuan666 merged 5 commits into
mainfrom
develop

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

This commit refactors all command modules to adopt the new pipeline architecture. The changes include:

Command Module Restructuring

  • Unified all command modules to follow the cmd:<command> naming convention
  • Replaced legacy option parsing with the new type-safe CommandContext system
  • Implemented pipeline component separation for validation and processing logic
  • Removed deprecated auto_flags.h and migrated to the new option handling system

Build System Updates

  • Raised CMake minimum version requirement to 3.30.0
  • Updated module dependencies and compilation targets
  • Enhanced build configuration for better module isolation

Documentation Improvements

  • Added comprehensive management command documentation (activate, deactivate, status, list, help)
  • Updated architecture design documentation to reflect the pipeline approach
  • Rewrote option handling guide for the new type-safe system
  • Improved scaffold and DSL documentation for command creation
  • Synchronized content between English and Chinese documentation versions

Key Architectural Changes

  1. Pipeline Pattern: Each command now follows a clear pipeline structure with separate components for input validation, processing, and output generation
  2. Type Safety: The new CommandContext provides compile-time type checking for option access
  3. Module Consistency: All commands now share a consistent module structure and interface
  4. Improved Error Handling: Better separation of validation errors from processing logic

Breaking Changes

  • The auto_flags.h header is no longer available - migrate to the new option system
  • Command module imports must now use the cmd: prefix (e.g., import cmd:ls)
  • Minimum CMake version requirement is now 3.30.0

The refactor improves maintainability, provides better type safety, and establishes a clear architectural pattern for future command development.

- Enable default testing functionality
- Remove MSVC exception handling configuration
- Adjust source file path structure
- Add precompiled header support
- Rename test directory from 'test' to 'tests'

refactor(tests): Implement custom test logic and remove catch2 dependency

- Implemented custom test logic
- Removed dependency on catch2 for testing framework

feat(main): Create main entry point and implement command dispatching

- Create program main entry at src/Main/main.cpp
- Implement command-line argument parsing, wildcard expansion, command dispatching functionality
- Add help information display

feat(utils): Add wildcard processing module

- Create src/Main/wildcard_handler.cppm module
- Implement wildcard expansion functionality for command-line arguments

fix(cat): Replace standard output functions with safe print functions

- Replace printf/fprintf/wprintf functions in cat command with safePrint family functions
- Ensure correct output in both console and pipe modes

refactor(cp): Update cp command implementation and fix error output

- Update cp command option definitions and error message output methods
- Use safePrint function family to replace traditional fprintf/wprintf functions
- Improve error handling and user interaction

docs(cp): Update cp command documentation comment format

- Standardize contributor comment format
- Optimize option description line break layout
- Improve code readability
- Implemented complete echo command with support for --upper and --repeat options
- Extended CommandMeta system to support different option types (bool, int, string)
- Added blank line formatting to option documentation for various command modules
- Introduced CommandContext struct for unified command parameter handling
- Refactored command metadata registration mechanism to support runtime type erasure
- Introduce modern way to this project
- The extra code would be adjust later(Next commit)
This commit refactors all command modules to adopt the new pipeline architecture. The changes include:

## Command Module Restructuring
- Unified all command modules to follow the `cmd:<command>` naming convention
- Replaced legacy option parsing with the new type-safe `CommandContext` system
- Implemented pipeline component separation for validation and processing logic
- Removed deprecated `auto_flags.h` and migrated to the new option handling system

## Build System Updates
- Raised CMake minimum version requirement to 3.30.0
- Updated module dependencies and compilation targets
- Enhanced build configuration for better module isolation

## Documentation Improvements
- Added comprehensive management command documentation (`activate`, `deactivate`, `status`, `list`, `help`)
- Updated architecture design documentation to reflect the pipeline approach
- Rewrote option handling guide for the new type-safe system
- Improved scaffold and DSL documentation for command creation
- Synchronized content between English and Chinese documentation versions

## Key Architectural Changes
1. **Pipeline Pattern**: Each command now follows a clear pipeline structure with separate components for input validation, processing, and output generation
2. **Type Safety**: The new `CommandContext` provides compile-time type checking for option access
3. **Module Consistency**: All commands now share a consistent module structure and interface
4. **Improved Error Handling**: Better separation of validation errors from processing logic

## Breaking Changes
- The `auto_flags.h` header is no longer available - migrate to the new option system
- Command module imports must now use the `cmd:` prefix (e.g., `import cmd:ls`)
- Minimum CMake version requirement is now 3.30.0

The refactor improves maintainability, provides better type safety, and establishes a clear architectural pattern for future command development.
@caomengxuan666
caomengxuan666 merged commit a888660 into main Feb 7, 2026
2 checks passed
caomengxuan666 added a commit that referenced this pull request Mar 24, 2026
refactor(cmd): restructure command modules and update documentation
caomengxuan666 added a commit that referenced this pull request Oct 31, 2026
Oracle: sed-4.9 sed/compile.c.
- q/Q with two addresses are a compile error in GNU (compile.c:1155-
  1158, ONE_ADDR); they were silently accepted and run.
- Address 0 is valid only as 0,/RE/ or alone on the r command
  (compile.c:1020-1027, INVALID_LINE_0); 0,2 and bare 0 were silently
  accepted as a never-matching line address. Both checks also apply
  to brace-group address pairs.
- The v command was missing entirely ('unsupported script command');
  GNU treats it as a version gate (compile.c:1064-1076): the argument
  (default 4.0) is strverscmp-compared against PACKAGE_VERSION 4.9 and
  a newer request is a compile error ('expected newer version of
  sed'); otherwise a no-op. Rejected under --posix like GNU.

Golden cases: corpus/sed/01..05 (error-text cases recorded as
KNOWN_DIFF with whitelist explanations: GNU prefixes script errors
with '-e expression #1, char N:', winuxcmd prints 'sed: <message>').

Refs #1462
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.

1 participant