Skip to content

Commit

Permalink
feat(tasks): add --json flag (#2116)
Browse files Browse the repository at this point in the history
* tasks: add --json flag

Fixes #2043

* Render help
  • Loading branch information
vrslev authored and jdx committed May 15, 2024
1 parent d327027 commit bf4af3c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ mod migrate;
mod path_env;
mod plugins;
mod rand;
mod registry;
mod runtime_symlinks;
mod shell;
mod shims;
Expand Down
28 changes: 28 additions & 0 deletions src/registry.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use std::collections::HashMap;

use once_cell::sync::Lazy;

use crate::cli::args::ForgeArg;

const REGISTRY: &[(&str, &str)] = &[
("ubi", "cargo:ubi"),
("elixir", "asdf:mise-plugins/mise-elixir"),
];

static MAP: Lazy<HashMap<&'static str, ForgeArg>> =
Lazy::new(|| REGISTRY.iter().map(|(k, v)| (*k, (*v).into())).collect());

pub fn get(s: &str) -> Option<&'static ForgeArg> {
MAP.get(s)
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_get() {
assert_eq!(get("ubi").unwrap().id, "cargo:ubi");
assert_eq!(get("unknown"), None);
}
}

0 comments on commit bf4af3c

Please sign in to comment.