summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfilip <filipbachul@gmail.com>2021-04-29 23:22:20 +0200
committerGitHub <noreply@github.com>2021-04-29 23:22:20 +0200
commit540c2c2475571f93a7ecaf813a7832f31cc6d8be (patch)
treeec96a4a86f992d3d4c53b0471ba1121c1afb92fb
parentc2e84e1802931197acb3eba957b78134e33cc7e8 (diff)
feat: Add version formating for modules (#2611)
* format crystal version with VersionFormatter * update crystal dosc * format crystal module * fix typos * format dart version with VersionFormatter * fix dart malformed test * update dart docs * format cmake version with VersionFormatter * update cmake docs * format deno version with VersionFormatter * update deno docs * remove Version type * format dotnet version with VersionFormatter * update dotnet docs * format erlang version with VersionFormatter * update erlang docs * format golang version with VersionFormatter * refactor formatting in my modules * format helm version with VersionFormatter * format julia version with VersionFormatter * format kotlin version with VersionFormatter * format lua version with VersionFormatter * format nim version with VersionFormatter * format perl version with VersionFormatter * format php version with VersionFormatter * format purescript version with VersionFormatter * format scala version with VersionFormatter * format swift version with VersionFormatter * format terraform version with VersionFormatter * format vagrant version with VersionFormatter * format zig version with VersionFormatter * format elixir version with VersionFormatter * format ocaml version with VersionFormatter * update elixir docs * update golang docs * update helm docs * update julia docs * update kotlin docs * update lua docs * update nim docs * update ocaml docs * update perl docs * update php docs * update purescript docs * update scala docs * update swift docs * update terraform docs * update vagrant docs * update zig docs * format elm version with VersionFormatter * update elm docs * pass module_name as &str to format_module_version
-rw-r--r--docs/config/README.md407
-rw-r--r--src/configs/cmake.rs2
-rw-r--r--src/configs/crystal.rs2
-rw-r--r--src/configs/dart.rs2
-rw-r--r--src/configs/deno.rs2
-rw-r--r--src/configs/dotnet.rs2
-rw-r--r--src/configs/elixir.rs2
-rw-r--r--src/configs/elm.rs2
-rw-r--r--src/configs/erlang.rs2
-rw-r--r--src/configs/go.rs2
-rw-r--r--src/configs/helm.rs2
-rw-r--r--src/configs/julia.rs2
-rw-r--r--src/configs/kotlin.rs2
-rw-r--r--src/configs/lua.rs2
-rw-r--r--src/configs/nim.rs2
-rw-r--r--src/configs/ocaml.rs6
-rw-r--r--src/configs/perl.rs6
-rw-r--r--src/configs/php.rs6
-rw-r--r--src/configs/purescript.rs2
-rw-r--r--src/configs/scala.rs4
-rw-r--r--src/configs/swift.rs2
-rw-r--r--src/configs/terraform.rs2
-rw-r--r--src/configs/vagrant.rs2
-rw-r--r--src/configs/zig.rs2
-rw-r--r--src/formatter/version.rs14
-rw-r--r--src/modules/cmake.rs28
-rw-r--r--src/modules/crystal.rs33
-rw-r--r--src/modules/dart.rs35
-rw-r--r--src/modules/deno.rs42
-rw-r--r--src/modules/dotnet.rs42
-rw-r--r--src/modules/elixir.rs12
-rw-r--r--src/modules/elm.rs9
-rw-r--r--src/modules/erlang.rs13
-rw-r--r--src/modules/golang.rs18
-rw-r--r--src/modules/helm.rs54
-rw-r--r--src/modules/java.rs2
-rw-r--r--src/modules/julia.rs23
-rw-r--r--src/modules/kotlin.rs39
-rw-r--r--src/modules/lua.rs17
-rw-r--r--src/modules/nim.rs8
-rw-r--r--src/modules/nodejs.rs2
-rw-r--r--src/modules/ocaml.rs8
-rw-r--r--src/modules/perl.rs8
-rw-r--r--src/modules/php.rs18
-rw-r--r--src/modules/purescript.rs8
-rw-r--r--src/modules/python.rs2
-rw-r--r--src/modules/ruby.rs2
-rw-r--r--src/modules/rust.rs2
-rw-r--r--src/modules/scala.rs14
-rw-r--r--src/modules/swift.rs17
-rw-r--r--src/modules/terraform.rs43
-rw-r--r--src/modules/vagrant.rs24
-rw-r--r--src/modules/zig.rs11
53 files changed, 601 insertions, 414 deletions
diff --git a/docs/config/README.md b/docs/config/README.md
index 056a39aa3..1613eaad9 100644
--- a/docs/config/README.md
+++ b/docs/config/README.md
@@ -466,15 +466,16 @@ the module will be activated if any of the following conditions are met:
### Options
-| Option | Default | Description |
-| ------------------- | -------------------------------------- | -------------------------------------------- |
-| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
-| `symbol` | `"△ "` | The symbol used before the version of cmake. |
-| `detect_extensions` | `[]` | Which extensions should trigger this module |
-| `detect_files` | `["CMakeLists.txt", "CMakeCache.txt"]` | Which filenames should trigger this module |
-| `detect_folders` | `[]` | Which folders should trigger this module |
-| `style` | `"bold blue"` | The style for the module. |
-| `disabled` | `false` | Disables the `cmake` 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`|
+| `symbol` | `"△ "` | The symbol used before the version of cmake. |
+| `detect_extensions` | `[]` | Which extensions should trigger this module |
+| `detect_files` | `["CMakeLists.txt", "CMakeCache.txt"]` | Which filenames should trigger this module |
+| `detect_folders` | `[]` | Which folders should trigger this module |
+| `style` | `"bold blue"` | The style for the module. |
+| `disabled` | `false` | Disables the `cmake` module. |
### Variables
@@ -592,15 +593,16 @@ By default the module will be shown if any of the following conditions are met:
### Options
-| Option | Default | Description |
-| ------------------- | ------------------------------------ | --------------------------------------------------------- |
-| `symbol` | `"🔮 "` | The symbol used before displaying the version of crystal. |
-| `style` | `"bold red"` | The style for the module. |
-| `detect_extensions` | `["cr"]` | Which extensions should trigger this module. |
-| `detect_files` | `["shard.yml"]` | Which filenames should trigger this module. |
-| `detect_folders` | `[]` | Which folders should trigger this module. |
-| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
-| `disabled` | `false` | Disables the `crystal` module. |
+| Option | Default | Description |
+| ------------------- | ------------------------------------ | ------------------------------------------------------------------------ |
+| `symbol` | `"🔮 "` | The symbol used before displaying the version of crystal. |
+| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
+| `version_format` | `v{raw}` | The version format. Available vars are `raw`, `major`, `minor`, & `patch`|
+| `style` | `"bold red"` | The style for the module. |
+| `detect_extensions` | `["cr"]` | Which extensions should trigger this module. |
+| `detect_files` | `["shard.yml"]` | Which filenames should trigger this module. |
+| `detect_folders` | `[]` | Which folders should trigger this module. |
+| `disabled` | `false` | Disables the `crystal` module. |
### Variables
@@ -632,15 +634,16 @@ By default the module will be shown if any of the following conditions are met:
### Options
-| Option | Default | Description |
-| ------------------- | ------------------------------------------------- | ----------------------------------------------- |
-| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
-| `symbol` | `"🎯 "` | A format string representing the symbol of Dart |
-| `detect_extensions` | `["dart"]` | Which extensions should trigger this module. |
-| `detect_files` | `["pubspec.yaml", "pubspec.yml", "pubspec.lock"]` | Which filenames should trigger this module. |
-| `detect_folders` | `[".dart_tool"]` | Which folders should trigger this module. |
-| `style` | `"bold blue"` | The style for the module. |
-| `disabled` | `false` | Disables the `dart` 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`|
+| `symbol` | `"🎯 "` | A format string representing the symbol of Dart |
+| `detect_extensions` | `["dart"]` | Which extensions should trigger this module. |
+| `detect_files` | `["pubspec.yaml", "pubspec.yml", "pubspec.lock"]` | Which filenames should trigger this module. |
+| `detect_folders` | `[".dart_tool"]` | Which folders should trigger this module. |
+| `style` | `"bold blue"` | The style for the module. |
+| `disabled` | `false` | Disables the `dart` module. |
### Variables
@@ -669,15 +672,16 @@ By default the module will be shown if any of the following conditions are met:
### Options
-| Option | Default | Description |
-| ------------------- | ------------------------------------------------- | ----------------------------------------------- |
-| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
-| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
-| `detect_extensions` | `[]` | Which extensions should trigger this module. |
-| `detect_files` | `["mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
-| `detect_folders` | `[]` | Which folders should trigger this module. |
-| `style` | `"green bold"` | The style for the module. |
-| `disabled` | `false` | Disables the `deno` 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` |
+| `symbol` | `"🦕 "` | A format string representing the symbol of Deno |
+| `detect_extensions` | `[]` | Which extensions should trigger this module. |
+| `detect_files` | `["mod.ts", "mod.js", "deps.ts", "deps.js"]` | Which filenames should trigger this module. |
+| `detect_folders` | `[]` | Which folders should trigger this module. |
+| `style` | `"green bold"` | The style for the module. |
+| `disabled` | `false` | Disables the `deno` module. |
### Variables
@@ -839,16 +843,17 @@ when there is a csproj file in the current directory.
### Options
-| Option | Default | Description |
-| ------------------- | ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
-| `format` | `"[$symbol($version )(🎯 $tfm )]($style)"` | The format for the module. |
-| `symbol` | `".NET "` | The symbol used before displaying the version of dotnet. |
-| `heuristic` | `true` | Use faster version detection to keep starship snappy. |
-| `detect_extensions` | `["sln", "csproj", "fsproj", "xproj"]` | Which extensions should trigger this module. |
-| `detect_files` | `["global.json", "project.json", "Directory.Build.props", "Directory.Build.targets", "Packages.props"]` | Which filenames should trigger this module. |
-| `detect_folders` | `[]` | Which folders should trigger this modules. |
-| `style` | `"bold blue"` | The style for the module. |
-| `disabled` | `false` | Disables the `dotnet` module. |
+| Option | Default | Description |
+| ------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
+| `format` | `"[$symbol($version )(🎯 $tfm )]($style)"` | The format for the module. |
+| `version_format` | `v{raw}` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
+| `symbol` | `".NET "` | The symbol used before displaying the version of dotnet. |
+| `heuristic` | `true` | Use faster version detection to keep starship snappy. |
+| `detect_extensions` | `["sln", "csproj", "fsproj", "xproj"]` | Which extensions should trigger this module. |
+| `detect_files` | `["global.json", "project.json", "Directory.Build.props", "Directory.Build.targets", "Packages.props"]` | Which filenames should trigger this module. |
+| `detect_folders` | `[]` | Which folders should trigger this modules. |
+| `style` | `"bold blue"` | The style for the module. |
+| `disabled` | `false` | Disables the `dotnet` module. |
### Variables
@@ -881,15 +886,16 @@ By default the module will be shown if any of the following conditions are met:
### Options
-| Option | Default | Description |
-| ------------------- | --------------------------------------------------------- | --------------------------------------------------------------- |
-| `symbol` | `"💧 "` | The symbol used before displaying the version of Elixir/Erlang. |
-| `detect_extensions` | `[]` | Which extensions should trigger this module. |
-| `detect_files` | `["mix.exs"]` | Which filenames should trigger this module. |
-| `detect_folders` | `[]` | Which folders should trigger this modules. |
-| `style` | `"bold purple"` | The style for the module. |
-| `format` | `'via [$symbol($version \(OTP $otp_version\) )]($style)'` | The format for the module elixir. |
-| `disabled` | `false` | Disables the `elixir` module. |
+| Option | Default | Description |
+| ------------------- | --------------------------------------------------------- | ------------------------------------------------------------------------- |
+| `format` | `'via [$symbol($version \(OTP $otp_version\) )]($style)'` | The format for the module elixir. |
+| `version_format` | `v{raw}` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
+| `symbol` | `"💧 "` | The symbol used before displaying the version of Elixir/Erlang. |
+| `detect_extensions` | `[]` | Which extensions should trigger this module. |
+| `detect_files` | `["mix.exs"]` | Which filenames should trigger this module. |
+| `detect_folders` | `[]` | Which folders should trigger this modules. |
+| `style` | `"bold purple"` | The style for the module. |
+| `disabled` | `false` | Disables the `elixir` module. |
### Variables
@@ -924,15 +930,16 @@ By default the module will be shown if any of the following conditions are met:
### Options
-| Option | Default | Description |
-| ------------------- | -------------------------------------------------- | ----------------------------------------------- |
-| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
-| `symbol` | `"🌳 "` | A format string representing the symbol of Elm. |
-| `detect_extensions` | `["elm"]` | Which extensions should trigger this module. |
-| `detect_files` | `["elm.json", "elm-package.json", ".elm-version"]` | Which filenames should trigger this module. |
-| `detect_folders` | `["elm-stuff"]` | Which folders should trigger this modules. |
-| `style` | `"cyan bold"` | The style for the module. |
-| `disabled` | `false` | Disables the `elm` 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` |
+| `symbol` | `"🌳 "` | A format string representing the symbol of Elm. |
+| `detect_extensions` | `["elm"]` | Which extensions should trigger this module. |
+| `detect_files` | `["elm.json", "elm-package.json", ".elm-version"]` | Which filenames should trigger this module. |
+| `detect_folders` | `["elm-stuff"]` | Which folders should trigger this modules. |
+| `style` | `"cyan bold"` | The style for the module. |
+| `disabled` | `false` | Disables the `elm` module. |
### Variables
@@ -1001,15 +1008,16 @@ By default the module will be shown if any of the following conditions are met:
### Options
-| Option | Default | Description |
-| ------------------- | ------------------------------------ | -------------------------------------------------------- |
-| `symbol` | `" "` | The symbol used before displaying the version of erlang. |
-| `style` | `"bold red"` | The style for the module. |
-| `detect_extensions` | `[]` | Which extensions should trigger this module. |
-| `detect_files` | `["rebar.config", "elang.mk"]` | Which filenames should trigger this module. |
-| `detect_folders` | `[]` | Which folders should trigger this modules. |
-| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
-| `disabled` | `false` | Disables the `erlang` 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` |
+| `symbol` | `" "` | The symbol used before displaying the version of erlang. |
+| `style` | `"bold red"` | The style for the module. |
+| `detect_extensions` | `[]` | Which extensions should trigger this module. |
+| `detect_files` | `["rebar.config", "elang.mk"]` | Which filenames should trigger this module. |
+| `detect_folders` | `[]` | Which folders should trigger this modules. |
+| `disabled` | `false` | Disables the `erlang` module. |
### Variables
@@ -1309,15 +1317,16 @@ By default the module will be shown if any of the following conditions are met:
### Options
-| Option | Default | Description |
-| -------------------- | ------------------------------------------------------------------------------ | ---------------------------------------------- |
-| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
-| `symbol` | `"🐹 "` | A format string representing the symbol of Go. |
-| `detect_extensions` | `["go"]` | Which extensions should trigger this module. |
-| `detect_files` | `["go.mod", "go.sum", "glide.yaml", "Gopkg.yml", "Gopkg.lock", ".go-version"]` | Which filenames should trigger this module. |
-| `detect_folders` | `["Godeps"]` | Which folders should trigger this module. |
-| `style` | `"bold cyan"` | The style for the module. |
-| `disabled` | `false` | Disables the `golang` 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` |
+| `symbol` | `"🐹 "` | A format string representing the symbol of Go. |
+| `detect_extensions` | `["go"]` | Which extensions should trigger this module. |
+| `detect_files` | `["go.mod", "go.sum", "glide.yaml", "Gopkg.yml", "Gopkg.lock", ".go-version"]` | Which filenames should trigger this module. |
+| `detect_folders` | `["Godeps"]` | Which folders should trigger this module. |
+| `style` | `"bold cyan"` | The style for the module. |
+| `disabled` | `false` | Disables the `golang` module. |
### Variables
@@ -1348,15 +1357,16 @@ By default the module will be shown if any of the following conditions are met:
### Options
-| Option | Default | Description |
-| ------------------- | ------------------------------------ | ------------------------------------------------ |
-| `format` | `"via [$symbol($version )]($style)"` | The format for the module. |
-| `detect_extensions` | `[]` | Which extensions should trigger this module. |
-| `detect_files` | `["helmfile.yaml", "Chart.yaml"]` | Which filenames should trigger this module. |
-| `detect_folders` | `[]` | Which folders should trigger this modules. |
-| `symbol` | `"⎈ "` | A format string representing the symbol of Helm. |
-| `style` | `"bold white"` | The style for the module. |
-| `disabled` | `false` | Disables the `helm` 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` | `[]` | Which extensions should trigger this module. |
+| `detect_files` | `["helmfile.yaml", "Chart.yaml"]` | Which filenames should trigger this module. |
+| `detect_folders` | `[]` | Which folders should trigger this modules. |
+| `symbol` | `"⎈ "` | A format string representing the symbol of Helm. |
+| `style` | `"bold white"` | The style for the module.