diff --git a/docs/registry.md b/docs/registry.md index 8999ef8466..29b934fdf9 100644 --- a/docs/registry.md +++ b/docs/registry.md @@ -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) | diff --git a/registry.toml b/registry.toml index c37e8762b5..a5dadfcfb2 100644 --- a/registry.toml +++ b/registry.toml @@ -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"] diff --git a/src/aqua/aqua_template.rs b/src/aqua/aqua_template.rs index d9cab671b8..ac17bc99d7 100644 --- a/src/aqua/aqua_template.rs +++ b/src/aqua/aqua_template.rs @@ -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(_) => {} @@ -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]