Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ env = { NO_COLOR = "1" }
run = "mise render-mangen"

[tasks."render:fig"]
depends = ["build", "render:usage", "render:completions"]
depends = ["build", "render:usage"]
run = [
'usage generate fig --file mise.usage.kdl --out-file tasks/fig/src/mise.ts',
"tsx tasks/fig/addCustomGenerators.ts tasks/fig/src/mise.ts tasks/fig/src/mise.ts"
Expand Down
35 changes: 20 additions & 15 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn codegen_registry() {
let out_dir = env::var_os("OUT_DIR").unwrap();
let dest_path = Path::new(&out_dir).join("registry.rs");
let mut lines = vec![r#"
const _REGISTRY: &[(&str, &[&str])] = &["#
const _REGISTRY: &[(&str, &[&str], &[&str])] = &["#
.to_string()];

let registry: toml::Table = fs::read_to_string("registry.toml")
Expand All @@ -31,9 +31,19 @@ const _REGISTRY: &[(&str, &[&str])] = &["#
let tools = registry.get("tools").unwrap().as_table().unwrap();
let mut trusted_ids = HashSet::new();
for (short, info) in tools {
let info = info.as_array().unwrap();
let info = info.as_table().unwrap();
let aliases = info
.get("aliases")
.cloned()
.unwrap_or(toml::Value::Array(vec![]))
.as_array()
.unwrap()
.iter()
.map(|v| v.as_str().unwrap().to_string())
.collect::<Vec<_>>();
let backends = info.get("backends").unwrap().as_array().unwrap();
let mut fulls = vec![];
for backend in info {
for backend in backends {
match backend {
toml::Value::String(backend) => {
fulls.push(backend.to_string());
Expand All @@ -50,20 +60,15 @@ const _REGISTRY: &[(&str, &[&str])] = &["#
}
}
lines.push(format!(
r#" ("{short}", &["{fulls}"]),"#,
fulls = fulls.join("\", \"")
r#" ("{short}", &["{fulls}"], &[{aliases}]),"#,
fulls = fulls.join("\", \""),
aliases = aliases
.iter()
.map(|a| format!("\"{a}\""))
.collect::<Vec<_>>()
.join(", "),
));
}

lines.push(
r#"];

const _TRUSTED_IDS: &[&str] = &["#
.to_string(),
);
for id in trusted_ids {
lines.push(format!(r#" "{id}","#));
}
lines.push(r#"];"#.to_string());

fs::write(&dest_path, lines.join("\n")).unwrap();
Expand Down
3 changes: 2 additions & 1 deletion docs/registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ editLink: false
| git-chglog | [asdf:GoodwayGroup/asdf-git-chglog](https://github.com/GoodwayGroup/asdf-git-chglog) |
| git-cliff | [asdf:jylenhof/asdf-git-cliff](https://github.com/jylenhof/asdf-git-cliff) |
| gitconfig | [asdf:0ghny/asdf-gitconfig](https://github.com/0ghny/asdf-gitconfig) |
| github-cli | [asdf:bartlomiejdanek/asdf-github-cli](https://github.com/bartlomiejdanek/asdf-github-cli) |
| github-cli | [ubi:cli/cli](https://github.com/cli/cli) [asdf:bartlomiejdanek/asdf-github-cli](https://github.com/bartlomiejdanek/asdf-github-cli) |
| github-markdown-toc | [asdf:skyzyx/asdf-github-markdown-toc](https://github.com/skyzyx/asdf-github-markdown-toc) |
| gitleaks | [asdf:jmcvetta/asdf-gitleaks](https://github.com/jmcvetta/asdf-gitleaks) |
| gitsign | [asdf:spencergilbert/asdf-gitsign](https://github.com/spencergilbert/asdf-gitsign) |
Expand Down Expand Up @@ -616,6 +616,7 @@ editLink: false
| restic | [asdf:xataz/asdf-restic](https://github.com/xataz/asdf-restic) |
| restish | [ubi:danielgtaylor/restish](https://github.com/danielgtaylor/restish) [go:github.com/danielgtaylor/restish](https://pkg.go.dev/github.com/danielgtaylor/restish) |
| revive | [asdf:bjw-s/asdf-revive](https://github.com/bjw-s/asdf-revive) |
| rg | [ubi:BurntSushi/ripgrep](https://github.com/BurntSushi/ripgrep) [aqua:BurntSushi/ripgrep](https://github.com/BurntSushi/ripgrep) [asdf:https://gitlab.com/wt0f/asdf-ripgrep](https://gitlab.com/wt0f/asdf-ripgrep) |
| richgo | [asdf:paxosglobal/asdf-richgo](https://github.com/paxosglobal/asdf-richgo) |
| riff | [asdf:abinet/asdf-riff](https://github.com/abinet/asdf-riff) |
| ripgrep | [ubi:BurntSushi/ripgrep](https://github.com/BurntSushi/ripgrep) [aqua:BurntSushi/ripgrep](https://github.com/BurntSushi/ripgrep) [asdf:https://gitlab.com/wt0f/asdf-ripgrep](https://gitlab.com/wt0f/asdf-ripgrep) |
Expand Down
2 changes: 2 additions & 0 deletions e2e/tools/test_tools_alias
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ EOF

assert_contains "mise x mytool -- rtx-tiny" "rtx-tiny: v2.1.0"
assert_contains "mise x mytool-lts -- rtx-tiny" "rtx-tiny: v1.0.1"

assert_contains "mise x rg@14.0.0 -- rg --version" "ripgrep 14.0.0"
Loading