Skip to content

Commit

Permalink
fix: gradle aqua package (#3880)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx authored Dec 30, 2024
1 parent 7489357 commit 50f812c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ You can also specify the full name for a tool using `mise use aqua:1password/cli
| goss | [aqua:goss-org/goss](https://github.com/goss-org/goss) [asdf:raimon49/asdf-goss](https://github.com/raimon49/asdf-goss) |
| gotestsum | [aqua:gotestyourself/gotestsum](https://github.com/gotestyourself/gotestsum) [asdf:pmalek/mise-gotestsum](https://github.com/pmalek/mise-gotestsum) |
| graalvm | [asdf:asdf-community/asdf-graalvm](https://github.com/asdf-community/asdf-graalvm) |
| gradle | [asdf:rfrancis/asdf-gradle](https://github.com/rfrancis/asdf-gradle) [vfox:version-fox/vfox-gradle](https://github.com/version-fox/vfox-gradle) |
| gradle | [aqua:gradle/gradle-distributions](https://github.com/gradle/gradle-distributions) [asdf:rfrancis/asdf-gradle](https://github.com/rfrancis/asdf-gradle) [vfox:version-fox/vfox-gradle](https://github.com/version-fox/vfox-gradle) |
| gradle-profiler | [asdf:joschi/asdf-gradle-profiler](https://github.com/joschi/asdf-gradle-profiler) |
| grails | [asdf:weibemoura/asdf-grails](https://github.com/weibemoura/asdf-grails) |
| grain | [asdf:cometkim/asdf-grain](https://github.com/cometkim/asdf-grain) |
Expand Down
7 changes: 6 additions & 1 deletion registry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,12 @@ gotestsum.backends = [
"asdf:pmalek/mise-gotestsum"
]
graalvm.backends = ["asdf:asdf-community/asdf-graalvm"]
gradle.backends = ["asdf:rfrancis/asdf-gradle", "vfox:version-fox/vfox-gradle"]
gradle.backends = [
"aqua:gradle/gradle-distributions",
"asdf:rfrancis/asdf-gradle",
"vfox:version-fox/vfox-gradle"
]
gradle.depends = ["java"]
gradle-profiler.backends = ["asdf:joschi/asdf-gradle-profiler"]
grails.backends = ["asdf:weibemoura/asdf-grails"]
grain.backends = ["asdf:cometkim/asdf-grain"]
Expand Down
17 changes: 17 additions & 0 deletions src/aqua/aqua_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,21 @@ impl Parser<'_> {
s = str.to_string();
}
}
"trimSuffix" => {
let suffix = next_arg(&mut tokens)?;
let str = next_arg(&mut tokens)?;
if let Some(str) = str.strip_suffix(&suffix) {
s = str.to_string();
} else {
s = str.to_string();
}
}
"replace" => {
let from = next_arg(&mut tokens)?;
let to = next_arg(&mut tokens)?;
let str = next_arg(&mut tokens)?;
s = str.replace(&from, &to);
}
_ => bail!("unexpected function: {func}"),
},
Token::Whitespace(_) => {}
Expand Down Expand Up @@ -190,7 +205,9 @@ mod tests {
test_parse_trimv: (r#"trimV "v1.0.0""#, "1.0.0", hashmap!{}),
test_parse_trim_prefix: (r#"trimPrefix "v" "v1.0.0""#, "1.0.0", hashmap!{}),
test_parse_trim_prefix2: (r#"trimPrefix "v" "1.0.0""#, "1.0.0", hashmap!{}),
test_parse_trim_suffix: (r#"trimSuffix "-v1.0.0" "foo-v1.0.0""#, "foo", hashmap!{}),
test_parse_pipe: (r#"trimPrefix "foo-" "foo-v1.0.0" | trimV"#, "1.0.0", hashmap!{}),
test_parse_replace: (r#"replace "foo" "bar" "foo-bar""#, "bar-bar", hashmap!{}),
);

#[test]
Expand Down

0 comments on commit 50f812c

Please sign in to comment.