constraint system #7

Merged
navicore merged 1 commit from phase-5 into main 2025-06-28 22:04:54 +00:00
navicore commented 2025-06-28 22:02:04 +00:00 (Migrated from github.com)

New Flag Types:

  1. StringArray - Allows flags to be specified multiple times (e.g., --tag foo --tag bar)
  2. Choice - Restricts values to a predefined set (e.g., environment must be "dev", "staging", or "production")
  3. Range - Validates numeric values within a specific range (e.g., port must be between 1024-65535)
  4. File - Validates that the value is an existing file path
  5. Directory - Validates that the value is an existing directory path

Flag Constraint System:

  1. RequiredIf - A flag becomes required when another flag is set
  2. ConflictsWith - Flags that are mutually exclusive
  3. Requires - A flag that requires other flags to be set

Key Features:

  • Validation happens during flag parsing for immediate feedback
  • Enhanced error messages clearly explain validation failures
  • Help system automatically displays constraints (Choice shows options, Range shows min-max)
  • Comprehensive test coverage for all new features
  • Created advanced_flags_demo.rs example showcasing all features
New Flag Types: 1. StringArray - Allows flags to be specified multiple times (e.g., --tag foo --tag bar) 2. Choice - Restricts values to a predefined set (e.g., environment must be "dev", "staging", or "production") 3. Range - Validates numeric values within a specific range (e.g., port must be between 1024-65535) 4. File - Validates that the value is an existing file path 5. Directory - Validates that the value is an existing directory path Flag Constraint System: 1. RequiredIf - A flag becomes required when another flag is set 2. ConflictsWith - Flags that are mutually exclusive 3. Requires - A flag that requires other flags to be set Key Features: - Validation happens during flag parsing for immediate feedback - Enhanced error messages clearly explain validation failures - Help system automatically displays constraints (Choice shows options, Range shows min-max) - Comprehensive test coverage for all new features - Created advanced_flags_demo.rs example showcasing all features
Sign in to join this conversation.
No description provided.