mirror of
https://github.com/starship/starship.git
synced 2024-12-23 23:58:51 +01:00
feat(java): Add .sdkmanrc
for Java (#4888)
* Add `.sdkmanrc` for Java * Update config-schema.json, Add `.sdkmanrc` file for Java * Update doc
This commit is contained in:
parent
e6c5571fc9
commit
07c2298965
6
.github/config-schema.json
vendored
6
.github/config-schema.json
vendored
@ -809,7 +809,8 @@
|
||||
".java-version",
|
||||
"deps.edn",
|
||||
"project.clj",
|
||||
"build.boot"
|
||||
"build.boot",
|
||||
".sdkmanrc"
|
||||
],
|
||||
"detect_folders": [],
|
||||
"disabled": false,
|
||||
@ -3701,7 +3702,8 @@
|
||||
".java-version",
|
||||
"deps.edn",
|
||||
"project.clj",
|
||||
"build.boot"
|
||||
"build.boot",
|
||||
".sdkmanrc"
|
||||
],
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
@ -2208,21 +2208,21 @@ disabled = false
|
||||
The `java` module shows the currently installed version of [Java](https://www.oracle.com/java/).
|
||||
By default the module will be shown if any of the following conditions are met:
|
||||
|
||||
- The current directory contains a `pom.xml`, `build.gradle.kts`, `build.sbt`, `.java-version`, `deps.edn`, `project.clj`, or `build.boot` file
|
||||
- The current directory contains a `pom.xml`, `build.gradle.kts`, `build.sbt`, `.java-version`, `deps.edn`, `project.clj`, `build.boot`, or `.sdkmanrc` file
|
||||
- The current directory contains a file with the `.java`, `.class`, `.gradle`, `.jar`, `.clj`, or `.cljc` extension
|
||||
|
||||
### Options
|
||||
|
||||
| Option | Default | Description |
|
||||
| ------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
|
||||
| `format` | `'via [${symbol}(${version} )]($style)'` | The format for the module. |
|
||||
| `version_format` | `'v${raw}'` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
|
||||
| `detect_extensions` | `['java', 'class', 'gradle', 'jar', 'cljs', 'cljc']` | Which extensions should trigger this module. |
|
||||
| `detect_files` | `['pom.xml', 'build.gradle.kts', 'build.sbt', '.java-version', 'deps.edn', 'project.clj', 'build.boot']` | Which filenames should trigger this module. |
|
||||
| `detect_folders` | `[]` | Which folders should trigger this modules. |
|
||||
| `symbol` | `'☕ '` | A format string representing the symbol of Java |
|
||||
| `style` | `'red dimmed'` | The style for the module. |
|
||||
| `disabled` | `false` | Disables the `java` module. |
|
||||
| Option | Default | Description |
|
||||
| ------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
|
||||
| `format` | `'via [${symbol}(${version} )]($style)'` | The format for the module. |
|
||||
| `version_format` | `'v${raw}'` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
|
||||
| `detect_extensions` | `['java', 'class', 'gradle', 'jar', 'cljs', 'cljc']` | Which extensions should trigger this module. |
|
||||
| `detect_files` | `['pom.xml', 'build.gradle.kts', 'build.sbt', '.java-version', 'deps.edn', 'project.clj', 'build.boot', '.sdkmanrc']` | Which filenames should trigger this module. |
|
||||
| `detect_folders` | `[]` | Which folders should trigger this modules. |
|
||||
| `symbol` | `'☕ '` | A format string representing the symbol of Java |
|
||||
| `style` | `'red dimmed'` | The style for the module. |
|
||||
| `disabled` | `false` | Disables the `java` module. |
|
||||
|
||||
### Variables
|
||||
|
||||
|
@ -35,6 +35,7 @@ impl<'a> Default for JavaConfig<'a> {
|
||||
"deps.edn",
|
||||
"project.clj",
|
||||
"build.boot",
|
||||
".sdkmanrc",
|
||||
],
|
||||
detect_folders: vec![],
|
||||
}
|
||||
|
@ -245,6 +245,16 @@ mod tests {
|
||||
dir.close()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn folder_with_sdkman_file() -> io::Result<()> {
|
||||
let dir = tempfile::tempdir()?;
|
||||
File::create(dir.path().join(".sdkmanrc"))?.sync_all()?;
|
||||
let actual = ModuleRenderer::new("java").path(dir.path()).collect();
|
||||
let expected = Some(format!("via {}", Color::Red.dimmed().paint("☕ v13.0.2 ")));
|
||||
assert_eq!(expected, actual);
|
||||
dir.close()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn folder_with_gradle_kotlin_build_file() -> io::Result<()> {
|
||||
let dir = tempfile::tempdir()?;
|
||||
|
Loading…
Reference in New Issue
Block a user