f57baee6bc
IMP-5: Replace strings.Contains(arg, ":") heuristic with an allowlist of recognized attribute keys (ValidAttributeKeys). Colons in task descriptions (URLs, "Meeting: topic") are no longer misinterpreted as modifiers. Canonical key sets live in engine/keys.go and are shared across parseAddArgs, ParseFilter, and ParseModifier. ParseModifier now errors on unknown keys. IMP-4: delete command now loads the working set and resolves display IDs via GetTaskByDisplayID, matching the pattern used by done/modify. IMP-6: All action commands (done, delete, modify, start, stop) now return an error on no-match (stderr, exit 1). Previously done/delete printed to stdout and exited 0; start/stop had no check at all. Also adds requirements and design docs for the CLI UX improvements. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
31 lines
871 B
Go
31 lines
871 B
Go
package engine
|
|
|
|
// ValidAttributeKeys are the recognized key:value attribute names.
|
|
// Used by parseAddArgs (cmd/add.go), ParseFilter, and ParseModifier
|
|
// to distinguish modifiers from description text.
|
|
var ValidAttributeKeys = map[string]bool{
|
|
"due": true,
|
|
"priority": true,
|
|
"project": true,
|
|
"recur": true,
|
|
"status": true,
|
|
"wait": true,
|
|
"scheduled": true,
|
|
"until": true,
|
|
}
|
|
|
|
// DateKeys is the subset of ValidAttributeKeys that hold date values.
|
|
// Used by Modifier.Apply and Modifier.ApplyToNew for date parsing.
|
|
var DateKeys = map[string]bool{
|
|
"due": true,
|
|
"scheduled": true,
|
|
"wait": true,
|
|
"until": true,
|
|
}
|
|
|
|
// FilterOnlyKeys are additional keys valid in filter context but not as
|
|
// modifiers (e.g., uuid is a filter target, not something you set via modify).
|
|
var FilterOnlyKeys = map[string]bool{
|
|
"uuid": true,
|
|
}
|