huskies: merge 671_refactor_migrate_pipeline_state_consumers_from_string_comparisons_to_typed_pipelinestage_enum
This commit is contained in:
@@ -8,23 +8,26 @@
|
||||
///
|
||||
/// Valid stage names match the `.huskies/work/N_name/` directory scheme.
|
||||
pub fn is_valid_stage(stage: &str) -> bool {
|
||||
matches!(
|
||||
stage,
|
||||
"1_backlog" | "2_current" | "3_qa" | "4_merge" | "5_done" | "6_archived"
|
||||
)
|
||||
crate::pipeline_state::Stage::from_dir(stage).is_some()
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
/// Map a human-readable stage alias (e.g. `"backlog"`) to its directory name
|
||||
/// (e.g. `"1_backlog"`). Returns `None` for unrecognised aliases.
|
||||
pub fn stage_alias_to_dir(alias: &str) -> Option<&'static str> {
|
||||
use crate::pipeline_state::Stage;
|
||||
// Canonical directory names (e.g. "1_backlog") round-trip through the typed enum.
|
||||
if let Some(stage) = Stage::from_dir(alias) {
|
||||
return Some(stage.dir_name());
|
||||
}
|
||||
// Short human-readable aliases (user-facing input normalization).
|
||||
match alias {
|
||||
"backlog" | "1_backlog" => Some("1_backlog"),
|
||||
"current" | "2_current" => Some("2_current"),
|
||||
"qa" | "3_qa" => Some("3_qa"),
|
||||
"merge" | "4_merge" => Some("4_merge"),
|
||||
"done" | "5_done" => Some("5_done"),
|
||||
"archived" | "6_archived" => Some("6_archived"),
|
||||
"backlog" => Some("1_backlog"),
|
||||
"current" => Some("2_current"),
|
||||
"qa" => Some("3_qa"),
|
||||
"merge" => Some("4_merge"),
|
||||
"done" => Some("5_done"),
|
||||
"archived" => Some("6_archived"),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user