priority
Shared
--priority value parser for the task create and task update commands.Accepts either the labelled form (critical|high|medium|low|lowest, case-insensitive)
or the legacy integer form (0..=4). Returns the integer representation so that
downstream call sites and the storage schema are unchanged.
const ACCEPTED_FORMS
pub(in crate::cli::commands::task) const ACCEPTED_FORMS: &str = "0-4, critical, high, medium, low, lowest";Human-readable list of accepted forms, used in error messages and doc strings.
fn parse_priority
pub(in crate::cli::commands::task) fn parse_priority(value: &str) -> Result<u8, String>Parse a --priority argument value.
Tries the labelled form first, then falls back to the integer form. Both are
validated against Priority; the parsed value is returned as its u8
representation.
| Parameter | Type | Description |
|---|---|---|
value |
&str | the argument as typed: a label or a number |
| returns | Result<u8, String> | The priority as a u8, or an error message listing the accepted forms. |