Add parameter parsing with cmd-style quoting and action validation#39
Merged
Add parameter parsing with cmd-style quoting and action validation#39
Conversation
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'.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a new
ParameterParsermodule to handle command-line parameter parsing with support for cmd-style quoting, refactorsSettingsValidatorto 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
ParameterParsermodule (Class/ParameterParser.vb):key=valueparameter strings with support for quoted values containing spaces:key="value with spaces"=or empty keys) and handles duplicate keys (last write wins)Enhanced
SettingsValidator(Class/SettingsValidator.vb):ValidateTaskAction(action[, siblingActions])method to validate individual task actionsDependsOnreferences to sibling actionsUpdated
TaskRunner.ParseParameters(Class/TaskRunner.vb):ParameterParser.Parse()instead of inline string splittingForm validation integration:
ActionDialog.ValidateInput()now usesSettingsValidator.ValidateTaskAction()for consistent validation rulesTaskForm.OkButton_Click()calls newValidateTaskActions()to validate all actions before saving, checking cross-actionDependsOnconsistencyNew test project (
Tests/LiteTask.Tests.vbproj):ParameterParsercovering 11 scenarios: basic parsing, quoted values with spaces, mixed quoting, empty values, malformed tokens, duplicate keys, and whitespace toleranceDocumentation:
CHANGELOG.mddocumenting all changesLiteTaskData/lang/fr.xmlImplementation Details
SettingsValidatorso UI and persisted-task validation share the same rule setDependsOnvalidation checks sibling actions by name (case-insensitive) to prevent circular or missing dependencies