1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-28 15:56:28 +00:00

feat(java): Show Java module for Clojure projects (#966)

This commit is contained in:
Zane Shelby 2020-11-30 07:50:56 -05:00 committed by GitHub
parent f87af93d93
commit 389e006c00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 6 deletions

View File

@ -1336,8 +1336,8 @@ disabled = false
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`, `build.gradle.kts`, `build.sbt` or `.java-version` file - 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 file with the `.java`, `.class`, `.gradle` or `.jar` extension - The current directory contains a file with the `.java`, `.class`, `.gradle`, `.jar`, `.clj`, or `.cljc` extension
### Options ### Options

View File

@ -11,13 +11,21 @@ const JAVA_VERSION_PATTERN: &str = "(?P<version>[\\d\\.]+)[^\\s]*\\s(?:built|fro
/// Creates a module with the current Java version /// Creates a module with the current Java version
/// ///
/// 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`, `.gradle` or `.jar` extension /// - Current directory contains a file with a `.java`, `.class`, `.jar`, `.gradle`, `.clj`, or `.cljc` extension
/// - Current directory contains a `pom.xml`, `build.gradle.kts`, `build.sbt` or `.java-version` file /// - Current directory contains a `pom.xml`, `build.gradle.kts`, `build.sbt`, `.java-version`, `deps.edn`, `project.clj`, or `build.boot` 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.kts", "build.sbt", ".java-version"]) .set_files(&[
.set_extensions(&["java", "class", "jar", "gradle"]) "pom.xml",
"build.gradle.kts",
"build.sbt",
".java-version",
"deps.edn",
"project.clj",
"build.boot",
])
.set_extensions(&["java", "class", "jar", "gradle", "clj", "cljc"])
.is_match(); .is_match();
if !is_java_project { if !is_java_project {