Implement stronger type handling for command arguments #15

Open
opened 2025-11-19 13:20:09 +00:00 by glenux · 0 comments
Owner

title: Implement Stronger Type Handling for Command Arguments
description: Enhance type conversion and validation for command-line arguments across the application.
current_situation: Command arguments (args : Array(String)) are passed and manipulated as raw strings. Type conversion is minimal or occurs implicitly.
expected_outcome:

  • All command-line arguments are explicitly converted to their expected Crystal types (e.g., to_i, to_f, specific enums) immediately after parsing.
  • Validation is performed where necessary (e.g., integer ranges, valid string patterns).
  • Runtime errors due to incorrect argument types are minimized.
    technical_details:
  • Audit add_options methods in all Cli classes (Build, Scaffold, Plan, Write, Container).
  • Explicitly convert string arguments from opts.on blocks to their target types when setting Config properties.
  • Add validation logic (e.g., if value.to_i? before conversion) where user input could lead to type errors.

--- title: Implement Stronger Type Handling for Command Arguments description: Enhance type conversion and validation for command-line arguments across the application. current_situation: Command arguments (`args : Array(String)`) are passed and manipulated as raw strings. Type conversion is minimal or occurs implicitly. expected_outcome: - All command-line arguments are explicitly converted to their expected Crystal types (e.g., `to_i`, `to_f`, specific enums) immediately after parsing. - Validation is performed where necessary (e.g., integer ranges, valid string patterns). - Runtime errors due to incorrect argument types are minimized. technical_details: - Audit `add_options` methods in all `Cli` classes (Build, Scaffold, Plan, Write, Container). - Explicitly convert string arguments from `opts.on` blocks to their target types when setting `Config` properties. - Add validation logic (e.g., `if value.to_i?` before conversion) where user input could lead to type errors. ---
glenux changed title from b313533 Implement stronger type handling for command arguments to Implement stronger type handling for command arguments 2025-11-19 13:26:59 +00:00
glenux added this to the By Status project 2025-11-19 18:02:48 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: glenux/docmachine-cli#15
No description provided.