1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-16 01:57:07 +00:00

feat: Show Java module when build.sbt is present (#505)

* feat: Show Java icon and info when build.sbt detected

* docs: Mention build.sbt detection
This commit is contained in:
Maarten Mulders 2019-10-07 12:18:01 +02:00 committed by Matan Kushner
parent 72fbd5b1ba
commit 8058b51273
2 changed files with 3 additions and 3 deletions

View File

@ -712,7 +712,7 @@ style = "bold dimmed green"
The `java` module shows the currently installed version of Java. The `java` module shows the currently installed version of Java.
The module will be shown if any of the following conditions are met: The module will be shown if any of the following conditions are met:
- The current directory contains a `pom.xml` or `build.gradle` file - The current directory contains a `pom.xml`, `build.gradle` or `build.sbt` file
- The current directory contains a file with the `.java`, `.class` or `.jar` extension - The current directory contains a file with the `.java`, `.class` or `.jar` extension
### Options ### Options

View File

@ -8,11 +8,11 @@ use super::{Context, Module};
/// ///
/// Will display the Java version if any of the following criteria are met: /// Will display the Java version if any of the following criteria are met:
/// - Current directory contains a file with a `.java`, `.class` or `.jar` extension /// - Current directory contains a file with a `.java`, `.class` or `.jar` extension
/// - Current directory contains a `pom.xml` or `build.gradle` file /// - Current directory contains a `pom.xml`, `build.gradle` or `build.sbt` file
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> { pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let is_java_project = context let is_java_project = context
.try_begin_scan()? .try_begin_scan()?
.set_files(&["pom.xml", "build.gradle"]) .set_files(&["pom.xml", "build.gradle", "build.sbt"])
.set_extensions(&["java", "class", "jar"]) .set_extensions(&["java", "class", "jar"])
.is_match(); .is_match();