summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.dprint.json4
-rw-r--r--.github/workflows/release.yml49
-rw-r--r--.github/workflows/spell-check.yml2
-rw-r--r--.github/workflows/workflow.yml27
-rw-r--r--CHANGELOG.md26
-rw-r--r--Cargo.lock28
-rw-r--r--Cargo.toml12
-rw-r--r--README.md4
-rw-r--r--docs/.vitepress/theme/index.css4
-rw-r--r--docs/README.md14
-rw-r--r--docs/installing/README.md2
-rw-r--r--docs/public/logo-uwu.pngbin0 -> 155211 bytes
-rw-r--r--src/modules/scala.rs90
-rw-r--r--src/utils.rs4
14 files changed, 223 insertions, 43 deletions
diff --git a/.dprint.json b/.dprint.json
index 30d6bcf1a..2f2a32997 100644
--- a/.dprint.json
+++ b/.dprint.json
@@ -25,9 +25,9 @@
"target/"
],
"plugins": [
- "https://github.com/dprint/dprint-plugin-typescript/releases/download/0.90.4/plugin.wasm",
+ "https://github.com/dprint/dprint-plugin-typescript/releases/download/0.90.5/plugin.wasm",
"https://github.com/dprint/dprint-plugin-json/releases/download/0.19.2/plugin.wasm",
- "https://github.com/dprint/dprint-plugin-markdown/releases/download/0.16.4/plugin.wasm",
+ "https://github.com/dprint/dprint-plugin-markdown/releases/download/0.17.0/plugin.wasm",
"https://github.com/dprint/dprint-plugin-toml/releases/download/0.6.1/plugin.wasm"
]
}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index d4d9f44fa..21c767145 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -98,8 +98,7 @@ jobs:
- name: Setup | Install cargo-wix [Windows]
continue-on-error: true
- # aarch64 is only supported in wix 4.0 development builds
- if: matrix.os == 'windows-latest' && matrix.target != 'aarch64-pc-windows-msvc'
+ if: matrix.os == 'windows-latest'
run: cargo install --version 0.3.4 cargo-wix
env:
# cargo-wix does not require static crt
@@ -119,11 +118,37 @@ jobs:
- name: Build | Installer [Windows]
continue-on-error: true
- if: matrix.os == 'windows-latest' && matrix.target != 'aarch64-pc-windows-msvc'
+ if: matrix.os == 'windows-latest'
run: >
cargo wix -v --no-build --nocapture -I install/windows/main.wxs
--target ${{ matrix.target }}
- --output target/wix/starship-${{ matrix.target }}.msi
+ --output target/${{ matrix.target }}/release/starship-${{ matrix.target }}.msi
+
+ - name: Sign | Upload [Windows]
+ continue-on-error: true
+ if: matrix.os == 'windows-latest'
+ uses: actions/upload-artifact@v4
+ with:
+ name: unsigned-${{ matrix.name }}
+ path: |
+ target/${{ matrix.target }}/release/starship.exe
+ target/${{ matrix.target }}/release/starship-${{ matrix.target }}.msi
+
+ - name: Sign | Sign [Windows]
+ continue-on-error: true
+ if: matrix.os == 'windows-latest'
+ uses: signpath/github-action-submit-signing-request@v0.3
+ with:
+ api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
+ organization-id: '${{ vars.SIGNPATH_ORGANIZATION_ID }}'
+ project-slug: 'starship'
+ signing-policy-slug: 'test-signing'
+ github-artifact-name: 'unsigned-${{ matrix.name }}'
+ wait-for-completion: false
+ # TODO use release-signing certificate:
+ # signing-policy-slug: 'release-signing'
+ # wait-for-completion: true
+ # output-artifact-directory: 'target/${{ matrix.target }}/release'
- name: Post Build | Prepare artifacts [Windows]
if: matrix.os == 'windows-latest'
@@ -147,11 +172,11 @@ jobs:
- name: Release | Upload installer artifacts [Windows]
continue-on-error: true
- if: matrix.os == 'windows-latest' && matrix.target != 'aarch64-pc-windows-msvc'
+ if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: starship-${{ matrix.target }}.msi
- path: target/wix/starship-${{ matrix.target }}.msi
+ path: target/${{ matrix.target }}/release/starship-${{ matrix.target }}.msi
# Notarize starship binaries for MacOS and build notarized pkg installers
notarize_and_pkgbuild:
@@ -320,9 +345,9 @@ jobs:
needs: [release_please, github_build, upload_artifacts]
if: ${{ needs.release_please.outputs.release_created == 'true' }}
env:
- URL_64: https://github.com/starship/starship/releases/download/${{ needs.release_please.outputs.tag_name }}/starship-x86_64-pc-windows-msvc.msi
- URL_32: https://github.com/starship/starship/releases/download/${{ needs.release_please.outputs.tag_name }}/starship-i686-pc-windows-msvc.msi
- URL_ARM: https://github.com/starship/starship/releases/download/${{ needs.release_please.outputs.tag_name }}/starship-aarch64-pc-windows-msvc.zip
+ URL_64: https://github.com/starship/starship/releases/download/${{ needs.release_please.outputs.tag_name }}/starship-x86_64-pc-windows-msvc
+ URL_32: https://github.com/starship/starship/releases/download/${{ needs.release_please.outputs.tag_name }}/starship-i686-pc-windows-msvc
+ URL_ARM: https://github.com/starship/starship/releases/download/${{ needs.release_please.outputs.tag_name }}/starship-aarch64-pc-windows-msvc
steps:
# Publishing will fail if the repo is too far behind the upstream
- run: gh repo sync matchai/winget-pkgs
@@ -331,7 +356,11 @@ jobs:
- run: |
$version = '${{ needs.release_please.outputs.tag_name }}'.replace('v', '')
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
- ./wingetcreate.exe update Starship.Starship -s -v $version -u $env:URL_64 $env:URL_32 $env:URL_ARM -t ${{ secrets.GH_PAT }}
+ ./wingetcreate.exe update Starship.Starship -s -v $version `
+ -u ${{ env.URL_64 }}.msi ${{ env.URL_64 }}.zip `
+ ${{ env.URL_32 }}.msi ${{ env.URL_32 }}.zip `
+ ${{ env.URL_ARM }}.msi ${{ env.URL_ARM }}.zip `
+ -t ${{ secrets.GH_PAT }}
choco_update:
name: Update Chocolatey Package
diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml
index daa4b5ad5..6e9b0f165 100644
--- a/.github/workflows/spell-check.yml
+++ b/.github/workflows/spell-check.yml
@@ -7,4 +7,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - uses: crate-ci/typos@v1.20.10
+ - uses: crate-ci/typos@v1.21.0
diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml
index aa683ff51..79632412c 100644
--- a/.github/workflows/workflow.yml
+++ b/.github/workflows/workflow.yml
@@ -201,7 +201,9 @@ jobs:
- name: Build | Installer [Windows]
continue-on-error: true
if: matrix.os == 'windows-latest' && matrix.rust == 'stable'
- run: cargo wix --dbg-build -v --nocapture -I install/windows/main.wxs
+ run: >
+ cargo wix --dbg-build -v --nocapture -I install/windows/main.wxs
+ --output target/debug/starship-x86_64-pc-windows-msvc.msi
- name: Build | Chocolatey Package [Windows]
continue-on-error: true
@@ -219,6 +221,29 @@ jobs:
env:
STARSHIP_VERSION: v1.2.3
+ - name: Sign | Upload Executable [Windows]
+ uses: actions/upload-artifact@v4
+ continue-on-error: true
+ if: matrix.os == 'windows-latest' && matrix.rust == 'stable' && github.event_name == 'push' && github.repository == 'starship/starship'
+ with:
+ name: unsigned-artifacts-dbg
+ path: |
+ target/debug/starship.exe
+ target/debug/starship-x86_64-pc-windows-msvc.msi
+
+ - name: Sign | Sign [Windows]
+ uses: signpath/github-action-submit-signing-request@v0.3
+ continue-on-error: true
+ if: matrix.os == 'windows-latest' && matrix.rust == 'stable' && github.event_name == 'push' && github.repository == 'starship/starship'
+ with:
+ api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
+ organization-id: '${{ vars.SIGNPATH_ORGANIZATION_ID }}'
+ project-slug: 'starship'
+ github-artifact-name: 'unsigned-artifacts-dbg'
+ signing-policy-slug: 'test-signing'
+ wait-for-completion: true
+ output-artifact-directory: target/debug
+
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: github.repository == 'starship/starship'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 710eb3c88..6fc24f4a3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,31 @@
# Changelog
+## [1.19.0](https://github.com/starship/starship/compare/v1.18.2...v1.19.0) (2024-05-12)
+
+
+### Features
+
+* **container:** show name if available ([#5195](https://github.com/starship/starship/issues/5195)) ([3e3f18e](https://github.com/starship/starship/commit/3e3f18ef277c9bb3db9f60c964f280c7d981102c))
+* **gleam:** Add Gleam module ([#5886](https://github.com/starship/starship/issues/5886)) ([34a8f7e](https://github.com/starship/starship/commit/34a8f7e62845fd66df3f6f9003cb850f2b0d9bc5))
+* **k8s:** Add detect env vars option ([#4488](https://github.com/starship/starship/issues/4488)) ([e3b5dff](https://github.com/starship/starship/commit/e3b5dff3524608328de6ee3cbb390f8c640b0ce0))
+* **odin:** Add Odin Lang module ([#5873](https://github.com/starship/starship/issues/5873)) ([335c514](https://github.com/starship/starship/commit/335c514e9ee5fa5bc8a8294b4804ddf198504b97))
+* **username:** add aliases option ([#5855](https://github.com/starship/starship/issues/5855)) ([9c1eadd](https://github.com/starship/starship/commit/9c1eaddae154daed9e1d00faac414586f7920013))
+
+
+### Bug Fixes
+
+* **bash:** fix handling of the preserved DEBUG trap (used in Bash <= 4.3) ([#5908](https://github.com/starship/starship/issues/5908)) ([fe1a8df](https://github.com/starship/starship/commit/fe1a8df6fa5121cc83b288cf054a8ed16631d335))
+* **bash:** use `eval` instead of a procsub for the POSIX mode ([#5020](https://github.com/starship/starship/issues/5020)) ([0f859e8](https://github.com/starship/starship/commit/0f859e8b61c8ada354f4ea4147fb8752dca02c51))
+* **bash:** use eval instead of a procsub for the POSIX mode ([0f859e8](https://github.com/starship/starship/commit/0f859e8b61c8ada354f4ea4147fb8752dca02c51))
+* **bun:** change default icon ([#5880](https://github.com/starship/starship/issues/5880)) ([be4e97c](https://github.com/starship/starship/commit/be4e97c2d9169cbf0bc30e271dd4ba07530dc46f))
+* **scala:** use scala-cli first to avoid timeout ([2221a88](https://github.com/starship/starship/commit/2221a88f5ada124c657a265b878e37be47998766))
+* **xonsh:** remove `| cat` workaround from xonsh init ([#5113](https://github.com/starship/starship/issues/5113)) ([de5b7f0](https://github.com/starship/starship/commit/de5b7f041a8c88ecf912b3be3b32d70f76518348))
+
+
+### Performance Improvements
+
+* **scala:** use scala-cli first to avoid timeout ([#5952](https://github.com/starship/starship/issues/5952)) ([2221a88](https://github.com/starship/starship/commit/2221a88f5ada124c657a265b878e37be47998766))
+
## [1.18.2](https://github.com/starship/starship/compare/v1.18.1...v1.18.2) (2024-03-29)
diff --git a/Cargo.lock b/Cargo.lock
index 2119d6c27..6e66f77c4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2533,9 +2533,9 @@ dependencies = [
[[package]]
name = "schemars"
-version = "0.8.17"
+version = "0.8.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f55c82c700538496bdc329bb4918a81f87cc8888811bd123cf325a0f2f8d309"
+checksum = "fc6e7ed6919cb46507fb01ff1654309219f62b4d603822501b0b80d42f6f21ef"
dependencies = [
"dyn-clone",
"indexmap 1.9.3",
@@ -2547,9 +2547,9 @@ dependencies = [
[[package]]
name = "schemars_derive"
-version = "0.8.17"
+version = "0.8.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "83263746fe5e32097f06356968a077f96089739c927a61450efa069905eec108"
+checksum = "185f2b7aa7e02d418e453790dde16890256bbd2bcd04b7dc5348811052b53f49"
dependencies = [
"proc-macro2",
"quote",
@@ -2574,9 +2574,9 @@ dependencies = [
[[package]]
name = "semver"
-version = "1.0.22"
+version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca"
+checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
[[package]]
name = "semver-parser"
@@ -2589,18 +2589,18 @@ dependencies = [
[[package]]
name = "serde"
-version = "1.0.199"
+version = "1.0.201"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0c9f6e76df036c77cd94996771fb40db98187f096dd0b9af39c6c6e452ba966a"
+checksum = "780f1cebed1629e4753a1a38a3c72d30b97ec044f0aef68cb26650a3c5cf363c"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.199"
+version = "1.0.201"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "11bd257a6541e141e42ca6d24ae26f7714887b47e89aa739099104c7e4d3b7fc"
+checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865"
dependencies = [
"proc-macro2",
"quote",
@@ -2620,9 +2620,9 @@ dependencies = [
[[package]]
name = "serde_json"
-version = "1.0.116"
+version = "1.0.117"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813"
+checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3"
dependencies = [
"itoa",
"ryu",
@@ -2779,7 +2779,7 @@ checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
[[package]]
name = "starship"
-version = "1.18.2"
+version = "1.19.0"
dependencies = [
"chrono",
"clap",
@@ -2811,7 +2811,7 @@ dependencies = [
"regex",
"rust-ini",
"schemars",
- "semver 1.0.22",
+ "semver 1.0.23",
"serde",
"serde_json",
"sha1",
diff --git a/Cargo.toml b/Cargo.toml
index ab8e81167..ea36bc0ce 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "starship"
-version = "1.18.2"
+version = "1.19.0"
authors = ["Starship Contributors"]
build = "build.rs"
categories = ["command-line-utilities"]
@@ -69,9 +69,9 @@ rand = "0.8.5"
rayon = "1.10.0"
regex = { version = "1.10.4", default-features = false, features = ["perf", "std", "unicode-perl"] }
rust-ini = "0.21.0"
-semver = "1.0.22"
-serde = { version = "1.0.199", features = ["derive"] }
-serde_json = "1.0.116"
+semver = "1.0.23"
+serde = { version = "1.0.201", features = ["derive"] }
+serde_json = "1.0.117"
sha1 = "0.10.6"
shadow-rs = { version = "0.27.1", default-features = false }
# battery is optional (on by default) because the crate doesn't currently build for Termux
@@ -96,7 +96,7 @@ home = "0.5.9"
shell-words = "1.1.0"
[dependencies.schemars]
-version = "0.8.17"
+version = "0.8.19"
optional = true
features = ["preserve_order", "indexmap2"]
@@ -124,7 +124,7 @@ dunce = "1.0.4"
winres = "0.1.12"
[dev-dependencies]
-mockall = "0.12"
+mockall = "0.12.1"
tempfile = "3.10.1"
[profile.release]
diff --git a/README.md b/README.md
index ed47264bb..1d0488510 100644
--- a/README.md
+++ b/README.md
@@ -433,6 +433,8 @@ Please check out these previous works that helped inspire the creation of starsh
Support this project by [becoming a sponsor](https://github.com/sponsors/starship). Your name or logo will show up here with a link to your website.
+- Free code signing provided by [SignPath.io], certificate by [SignPath Foundation]
+
<p align="center">
<br>
<img width="100" src="https://raw.githubusercontent.com/starship/starship/master/media/icon.png" alt="Starship rocket icon">
@@ -458,6 +460,8 @@ This project is [ISC](https://github.com/starship/starship/blob/master/LICENSE)
[OSS]: https://software.opensuse.org/package/starship
[pkgsrc]: https://pkgsrc.se/shells/starship
[scoop]: https://github.com/ScoopInstaller/Main/blob/master/bucket/starship.json
+[SignPath Foundation]: https://signpath.org
+[SignPath.io]: https://signpath.io
[termux]: https://github.com/termux/termux-packages/tree/master/packages/starship
[void linux packages]: https://github.com/void-linux/void-packages/tree/master/srcpkgs/starship
[winget]: https://github.com/microsoft/winget-pkgs/tree/master/manifests/s/Starship/Starship
diff --git a/docs/.vitepress/theme/index.css b/docs/.vitepress/theme/index.css
index 0434a59e7..293e702af 100644
--- a/docs/.vitepress/theme/index.css
+++ b/docs/.vitepress/theme/index.css
@@ -21,6 +21,10 @@
transform: none;
}
+.VPHero .image img.uwu {
+ max-height: 290px;
+}
+
.VPHero .container .actions {
justify-content: center !important;
}
diff --git a/docs/README.md b/docs/README.md
index 2cf7a0c27..89164622c 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -22,6 +22,20 @@ metaTitle: "Starship: Cross-Shell Prompt"
description: Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the information you need, while staying sleek and minimal. Quick installation available for Bash, Fish, ZSH, Ion, Tcsh, Elvish, Nu, Xonsh, Cmd, and PowerShell.
---
+<script setup>
+import { onMounted } from 'vue'
+
+onMounted(() => {
+ const urlParams = new URLSearchParams(window.location.search)
+ if (urlParams.has('uwu') || urlParams.has('kawaii')) {
+ const img = document.querySelector('.VPHero .VPImage.image-src')
+ img.classList.add('uwu')
+ img.src = '/logo-uwu.png'
+ img.alt = 'Kawaii Starship Logo by @sawaratsuki1004'
+ }
+})
+</script>
+
<video class="demo-video" muted autoplay loop playsinline>
<source src="/demo.webm" type="video/webm">
<source src="/demo.mp4" type="video/mp4">
diff --git a/docs/installing/README.md b/docs/installing/README.md
index 019ea924e..898e67a89 100644
--- a/docs/installing/README.md
+++ b/docs/installing/README.md
@@ -49,7 +49,7 @@ On Funtoo Linux, starship can be installed from [core-kit](https://github.com/fu
emerge app-shells/starship
```
-## [Nix](https://nixos.wiki/wiki/Nix)
+## [Nix](https://wiki.nixos.org/wiki/Nix)
### Getting the Binary
diff --git a/docs/public/logo-uwu.png b/docs/public/logo-uwu.png
new file mode 100644
index 000000000..a939eaa89
--- /dev/null
+++ b/docs/public/logo-uwu.png
Binary files differ
diff --git a/src/modules/scala.rs b/src/modules/scala.rs
index e1c46be3e..36d8efa04 100644
--- a/src/modules/scala.rs
+++ b/src/modules/scala.rs
@@ -57,10 +57,17 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
}
fn get_scala_version(context: &Context) -> Option<String> {
- let command = context.exec_cmd("scalac", &["-version"])?;
- let scala_version_string = get_command_string_output(command);
-
- parse_scala_version(&scala_version_string)
+ // try to get the version from scala-cli first as it is faster
+ // and return ONLY the version which save us from parsing the version string
+ context
+ .exec_cmd("scala-cli", &["version", "--scala"])
+ .filter(|out| !out.stdout.is_empty())
+ .map(|std_out_only| std_out_only.stdout.trim().to_string())
+ .or_else(|| {
+ let command = context.exec_cmd("scalac", &["-version"])?;
+ let scala_version_string = get_command_string_output(command);
+ parse_scala_version(&scala_version_string)
+ })
}
fn parse_scala_version(scala_version_string: &str) -> Option<String> {
@@ -111,7 +118,21 @@ mod tests {
let dir = tempfile::tempdir()?;
File::create(dir.path().join("Test.scala"))?.sync_all()?;
let actual = ModuleRenderer::new("scala").path(dir.path()).collect();
- let expected = Some(format!("via {}", Color::Red.bold().paint("🆂 v2.13.5 ")));
+ let expected = Some(format!("via {}", Color::Red.bold().paint("🆂 v3.4.1 ")));
+ assert_eq!(expected, actual);
+ dir.close()
+ }
+
+ #[test]
+ fn folder_with_scala_file_using_scala_cli_only() -> io::Result<()> {
+ let dir = tempfile::tempdir()?;
+ File::create(dir.path().join("Test.scala"))?.sync_all()?;
+ let actual = ModuleRenderer::new("scala")
+ // for test purpose only real use case will have both in path
+ .cmd("scalac -version", None)
+ .path(dir.path())
+ .collect();
+ let expected = Some(format!("via {}", Color::Red.bold().paint("🆂 v3.4.1 ")));
assert_eq!(expected, actual);
dir.close()
}
@@ -121,6 +142,7 @@ mod tests {
let dir = tempfile::tempdir()?;
File::create(dir.path().join("Test.scala"))?.sync_all()?;
let actual = ModuleRenderer::new("scala")
+ .cmd("scala-cli version --scala", None)
.cmd("scalac -version", None)
.path(dir.path())
.collect();
@@ -134,7 +156,7 @@ mod tests {
let dir = tempfile::tempdir()?;
File::create(dir.path().join("build.sbt"))?.sync_all()?;
let actual = ModuleRenderer::new("scala").path(dir.path()).collect();
- let expected = Some(format!("via {}", Color::Red.bold().paint("🆂 v2.13.5 ")));
+ let expected = Some(format!("via {}", Color::Red.bold().paint("🆂 v3.4.1 ")));
assert_eq!(expected, actual);
dir.close()
}
@@ -144,7 +166,7 @@ mod tests {
let dir = tempfile::tempdir()?;
File::create(dir.path().join(".scalaenv"))?.sync_all()?;
let actual = ModuleRenderer::new("scala").path(dir.path()).collect();
- let expected = Some(format!("via {}", Color::Red.bold().paint("🆂 v2.13.5 ")));
+ let expected = Some(format!("via {}", Color::Red.bold().paint("🆂 v3.4.1 ")));
assert_eq!(expected, actual);
dir.close()
}
@@ -154,7 +176,7 @@ mod tests {
let dir = tempfile::tempdir()?;
File::create(dir.path().join(".sbtenv"))?.sync_all()?;
let actual = ModuleRenderer::new("scala").path(dir.path()).collect();
- let expected = Some(format!("via {}", Color::Red.bold().paint("🆂 v2.13.5 ")));
+ let expected = Some(format!("via {}", Color::Red.bold().paint("🆂 v3.4.1 ")));
assert_eq!(expected, actual);
dir.close()
}
@@ -164,6 +186,58 @@ mod tests {
let dir = tempfile::tempdir()?;
fs::create_dir_all(dir.path().join(".metals"))?;
let actual = ModuleRenderer::new("scala").path(dir.path()).collect();
+ let expected = Some(format!("via {}", Color::Red.bold().paint("🆂 v3.4.1 ")));
+ assert_eq!(expected, actual);
+ dir.close()
+ }
+
+ #[test]
+ fn folder_with_sbt_file_without_scala_cli() -> io::Result<()> {
+ let dir = tempfile::tempdir()?;
+ File::create(dir.path().join("build.sbt"))?.sync_all()?;
+ let actual = ModuleRenderer::new("scala")
+ .cmd("scala-cli version --scala", None)
+ .path(dir.path())
+ .collect();
+ let expected = Some(format!("via {}", Color::Red.bold().paint("🆂 v2.13.5 ")));
+ assert_eq!(expected, actual);
+ dir.close()
+ }
+
+ #[test]
+ fn folder_with_scala_env_file_without_scala_cli() -> io::Result<()> {
+ let dir = tempfile::tempdir()?;
+ File::create(dir.path().join(".scalaenv"))?.sync_all()?;
+ let actual = ModuleRenderer::new("scala")
+ .cmd("scala-cli version --scala", None)
+ .path(dir.path())
+ .collect();
+ let expected = Some(format!("via {}", Color::Red.bold().paint("🆂 v2.13.5 ")));
+ assert_eq!(expected, actual);
+ dir.close()
+ }
+
+ #[test]
+ fn folder_with_sbt_env_file_without_scala_cli() -> io::Result<()> {
+ let dir = tempfile::tempdir()?;
+ File::create(dir.path().join(".sbtenv"))?.sync_all()?;
+ let actual = ModuleRenderer::new("scala")
+ .cmd("scala-cli version --scala", None)
+ .path(dir.path())
+ .collect();
+ let expected = Some(format!("via {}", Color::Red.bold().paint("🆂 v2.13.5 ")));
+ assert_eq!(expected, actual);
+ dir.close()
+ }
+
+ #[test]
+ fn folder_with_metals_dir_without_scala_cli() -> io::Result<()> {
+ let dir = tempfile::tempdir()?;
+ fs::create_dir_all(dir.path().join(".metals"))?;
+ let actual = ModuleRenderer::new("scala")
+ .cmd("scala-cli version --scala", None)
+ .path(dir.path())
+ .collect();
let expected = Some(format!("via {}", Color::Red.bold().paint("🆂 v2.13.5 ")));
assert_eq!(expected, actual);
dir.close()
diff --git a/src/utils.rs b/src/utils.rs
index c2c54b629..d6b56e6c9 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -287,6 +287,10 @@ Elixir 1.10 (compiled with Erlang/OTP 22)\n",
stdout: String::from("OpenJDK 64-Bit Server VM (13.0.2+8) for bsd-amd64 JRE (13.0.2+8), built on Feb 6 2020 02:07:52 by \"brew\" with clang 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.17)"),
stderr: String::default(),
}),
+ "scala-cli version --scala" => Some(CommandOutput {
+ stdout: String::from("3.4.1"),
+ stderr: String::default(),
+ }),
"scalac -version" => Some(CommandOutput {
stdout: String::from("Scala compiler version 2.13.5 -- Copyright 2002-2020, LAMP/EPFL and Lightbend, Inc."),
stderr: String::default(),