diff options
author | Thomas O'Donnell <andytom@users.noreply.github.com> | 2021-02-21 19:56:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-21 19:56:48 +0100 |
commit | 1a6c625521510fee059bec168e73a49aef834c8c (patch) | |
tree | 0ce956cc4aca0aec1838e5b84e6fd759b34fcfda /src/modules | |
parent | fe6f9eeb4de899b813b6c42a60597a0b86429557 (diff) |
feat(kotlin): Configure when the module is shown (#2359)
This makes it possible to configure when the kotlin module is shown
based on the contents of a directory.
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/kotlin.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/modules/kotlin.rs b/src/modules/kotlin.rs index bebfb03aa..94015fa30 100644 --- a/src/modules/kotlin.rs +++ b/src/modules/kotlin.rs @@ -7,21 +7,21 @@ use regex::Regex; const KOTLIN_VERSION_PATTERN: &str = "(?P<version>[\\d\\.]+[\\d\\.]+[\\d\\.]+)"; /// Creates a module with the current Kotlin version -/// -/// Will display the Kotlin version if any of the following criteria are met: -/// - Current directory contains a file with a `.kt` or `.kts` extension pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> { + let mut module = context.new_module("kotlin"); + let config = KotlinConfig::try_load(module.config); + let is_kotlin_project = context .try_begin_scan()? - .set_extensions(&["kt", "kts"]) + .set_files(&config.detect_files) + .set_extensions(&config.detect_extensions) + .set_folders(&config.detect_folders) .is_match(); if !is_kotlin_project { return None; } - let mut module = context.new_module("kotlin"); - let config = KotlinConfig::try_load(module.config); let parsed = StringFormatter::new(config.format).and_then(|formatter| { formatter .map_meta(|var, _| match var { |