Skip to content

Add parameter parsing with cmd-style quoting and action validation#39

Merged
svtica merged 6 commits intomainfrom
claude/add-french-translations-Yv6sA
Apr 25, 2026
Merged

Add parameter parsing with cmd-style quoting and action validation#39
svtica merged 6 commits intomainfrom
claude/add-french-translations-Yv6sA

Conversation

@svtica
Copy link
Copy Markdown
Owner

@svtica svtica commented Apr 25, 2026

Summary

This PR introduces a new ParameterParser module to handle command-line parameter parsing with support for cmd-style quoting, refactors SettingsValidator to validate individual task actions, and integrates validation into the UI forms. A new MSTest project provides comprehensive test coverage for the parameter parser.

Key Changes

  • New ParameterParser module (Class/ParameterParser.vb):

    • Parses key=value parameter strings with support for quoted values containing spaces: key="value with spaces"
    • Maintains backward compatibility with the original whitespace-delimited unquoted form
    • Skips malformed tokens (missing = or empty keys) and handles duplicate keys (last write wins)
    • Tolerates leading/trailing whitespace
  • Enhanced SettingsValidator (Class/SettingsValidator.vb):

    • Added ValidateTaskAction(action[, siblingActions]) method to validate individual task actions
    • Validates: name/target presence, target file existence (for PowerShell/Batch/Executable types), timeout >= 1 minute, non-negative retry parameters, and DependsOn references to sibling actions
    • Prevents self-referential dependencies and validates cross-action consistency
  • Updated TaskRunner.ParseParameters (Class/TaskRunner.vb):

    • Delegates to the new ParameterParser.Parse() instead of inline string splitting
    • Enables cmd-style quoting support while maintaining backward compatibility
  • Form validation integration:

    • ActionDialog.ValidateInput() now uses SettingsValidator.ValidateTaskAction() for consistent validation rules
    • TaskForm.OkButton_Click() calls new ValidateTaskActions() to validate all actions before saving, checking cross-action DependsOn consistency
  • New test project (Tests/LiteTask.Tests.vbproj):

    • MSTest-based unit tests for ParameterParser covering 11 scenarios: basic parsing, quoted values with spaces, mixed quoting, empty values, malformed tokens, duplicate keys, and whitespace tolerance
  • Documentation:

    • Added CHANGELOG.md documenting all changes
    • Added French translations for new validation messages in LiteTaskData/lang/fr.xml
    • Updated solution and project files to include the new test project

Implementation Details

  • Parameter parsing uses a character-by-character state machine approach to handle quoted and unquoted values correctly
  • Validation is centralized in SettingsValidator so UI and persisted-task validation share the same rule set
  • The DependsOn validation checks sibling actions by name (case-insensitive) to prevent circular or missing dependencies

claude added 6 commits April 25, 2026 01:38
Adds SettingsValidator.ValidateTaskAction(action[, siblings]) covering
name/target presence, target file existence for PowerShell/Batch/Executable,
non-negative retry parameters, timeout >= 1, and DependsOn referencing a
sibling action's Name. ActionDialog now validates the candidate via the
shared validator; TaskForm validates every action against its siblings
after UpdateTaskFromForm. French translations added for the new keys.
Extracts the parsing logic into LiteTask.ParameterParser (Class/) so it can
be tested in isolation. The new parser supports key="value with spaces"
while remaining backward-compatible with key=value tokens. Adds an MSTest
project under Tests/ wired into LiteTask.sln, with 11 cases covering the
basic form, quoted spaces, mixed quoting, empty values, dropped tokens,
duplicate keys, and whitespace tolerance.
The test .vbproj already sets RootNamespace=LiteTask.Tests, and VB prepends
RootNamespace to declared namespaces. The 'Namespace LiteTask.Tests' wrapper
was producing the doubled name LiteTask.Tests.LiteTask.Tests.* — harmless at
runtime (MSTest discovers by attribute) but confusing. Class now lives at
LiteTask.Tests.ParameterParserTests as expected.
VB.NET has an intrinsic 'Err' object; using 'err' as a ForEach loop
variable triggers BC30068 'Expression is a value and therefore cannot be
the target of an assignment'. Renamed to 'actionError'.
@svtica svtica merged commit 8a24a53 into main Apr 25, 2026
1 check passed
@svtica svtica deleted the claude/add-french-translations-Yv6sA branch April 25, 2026 02:18
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