mirror of
https://github.com/starship/starship.git
synced 2024-12-14 03:00:53 +01:00
Merge branch 'master' into conditional-style
This commit is contained in:
commit
584bc77d02
2
.github/workflows/spell-check.yml
vendored
2
.github/workflows/spell-check.yml
vendored
@ -7,4 +7,4 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: crate-ci/typos@v1.14.12
|
||||
- uses: crate-ci/typos@v1.15.0
|
||||
|
2
.github/workflows/workflow.yml
vendored
2
.github/workflows/workflow.yml
vendored
@ -132,7 +132,7 @@ jobs:
|
||||
run: cargo run --locked --features config-schema -- config-schema > .github/config-schema.json
|
||||
|
||||
- name: Check | Detect Changes
|
||||
uses: reviewdog/action-suggester@v1.6.0
|
||||
uses: reviewdog/action-suggester@v1.6.1
|
||||
with:
|
||||
tool_name: starship config-schema
|
||||
filter_mode: nofilter
|
||||
|
112
Cargo.lock
generated
112
Cargo.lock
generated
@ -351,9 +351,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.3.2"
|
||||
version = "4.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "401a4694d2bf92537b6867d94de48c4842089645fdcdf6c71865b175d836e9c2"
|
||||
checksum = "80672091db20273a15cf9fdd4e47ed43b5091ec9841bf4c6145c9dfbbcae09ed"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
@ -362,9 +362,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.3.1"
|
||||
version = "4.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72394f3339a76daf211e57d4bcb374410f3965dcc606dd0e03738c7888766980"
|
||||
checksum = "c1458a1df40e1e2afebb7ab60ce55c1fa8f431146205aa5f4887e0b111c27636"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
@ -991,9 +991,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gix"
|
||||
version = "0.45.1"
|
||||
version = "0.46.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf2a03ec66ee24d1b2bae3ab718f8d14f141613810cb7ff6756f7db667f1cd82"
|
||||
checksum = "99368b48a2f68c3fdc26e62c6425bdc4baeb4f30a4f24eb2e0904d29a2ba97ab"
|
||||
dependencies = [
|
||||
"gix-actor",
|
||||
"gix-attributes",
|
||||
@ -1052,9 +1052,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gix-attributes"
|
||||
version = "0.13.0"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "644d4e1182dd21af10f455265eb15cb10ca3ae9c63475d7247e538e62ebacc56"
|
||||
checksum = "78b79590ac382f80d87e06416f5fcac6fee5d83dcb152a00ed0bdbaa988acc31"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"gix-glob",
|
||||
@ -1173,9 +1173,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gix-diff"
|
||||
version = "0.30.0"
|
||||
version = "0.30.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bed89e910e19b48d31132b2b5392cef60786dd081cca5d0e31de32064f7300eb"
|
||||
checksum = "9029ad0083cc286a4bd2f5b3bf66bb66398abc26f2731a2824cd5edfc41a0e33"
|
||||
dependencies = [
|
||||
"gix-hash",
|
||||
"gix-object",
|
||||
@ -1275,9 +1275,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gix-index"
|
||||
version = "0.17.0"
|
||||
version = "0.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "616ba958fabfb11263fa042c35690d48a6c7be4e9277e2c7e24ff263b3fe7b82"
|
||||
checksum = "ca0380cdab7863e67966eee4aed32856c864c20b077e026b637af6bb3a9281b4"
|
||||
dependencies = [
|
||||
"bitflags 2.2.1",
|
||||
"bstr",
|
||||
@ -1319,9 +1319,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gix-negotiate"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82297847a7ad2d920707da5fc9ca8bb5eadf2891948dbe65625db1ffaa9803f9"
|
||||
checksum = "945c3ef1e912e44a5f405fc9e924edf42000566a1b257ed52cb1293300f6f08c"
|
||||
dependencies = [
|
||||
"bitflags 2.2.1",
|
||||
"gix-commitgraph",
|
||||
@ -1353,9 +1353,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gix-odb"
|
||||
version = "0.46.0"
|
||||
version = "0.47.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b234d806278eeac2f907c8b5a105c4ba537230c1a9d9236d822bf0db291f8f3"
|
||||
checksum = "91d98eaba4f649fed17250651c4ddfaf997c80a30f5ee4b47ac9bc18ffe3eb16"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"gix-features",
|
||||
@ -1371,9 +1371,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gix-pack"
|
||||
version = "0.36.0"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d2a14cb3156037eedb17d6cb7209b7180522b8949b21fd0fe3184c0a1d0af88"
|
||||
checksum = "82e9e228f18cd87e7596e687b38619b5e4caebc678644ae6bb3d842598166d72"
|
||||
dependencies = [
|
||||
"clru",
|
||||
"gix-chunk",
|
||||
@ -1464,16 +1464,29 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gix-revision"
|
||||
version = "0.15.1"
|
||||
version = "0.15.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9abc4f68f85f42029ade0bece087aef7071016335772f0c7cb7d425aaaed3b33"
|
||||
checksum = "5044f56cd7a487ce9b034cbe0252ae0b6b47ff56ca3dabd79bc30214d0932cd7"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"gix-commitgraph",
|
||||
"gix-date",
|
||||
"gix-hash",
|
||||
"gix-hashtable",
|
||||
"gix-object",
|
||||
"gix-revwalk",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-revwalk"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc2623ba8747914f151f5e12b65adac576ab459dbed5f50a36c7a3e9cbf2d3ca"
|
||||
dependencies = [
|
||||
"gix-commitgraph",
|
||||
"gix-hash",
|
||||
"gix-hashtable",
|
||||
"gix-object",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
]
|
||||
@ -1507,13 +1520,16 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gix-traverse"
|
||||
version = "0.26.0"
|
||||
version = "0.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b0842e984cb4bf26339dc559f3a1b8bf8cdb83547799b2b096822a59f87f33d9"
|
||||
checksum = "8673546506391a10fdfd4e48c8e0f3ec92355cf1fac787d2e714c7d45e301ede"
|
||||
dependencies = [
|
||||
"gix-commitgraph",
|
||||
"gix-hash",
|
||||
"gix-hashtable",
|
||||
"gix-object",
|
||||
"gix-revwalk",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
@ -1552,9 +1568,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gix-worktree"
|
||||
version = "0.18.0"
|
||||
version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d388ad962e8854402734a7387af8790f6bdbc8d05349052dab16ca4a0def50f6"
|
||||
checksum = "0b32a0e7ed52577bfb050f5350bdee2741d1b08a9ed02a2f2df6effe353896ca"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"filetime",
|
||||
@ -1877,9 +1893,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.18"
|
||||
version = "0.4.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de"
|
||||
checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
|
||||
|
||||
[[package]]
|
||||
name = "mac-notification-sys"
|
||||
@ -2244,9 +2260,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
|
||||
|
||||
[[package]]
|
||||
name = "pest"
|
||||
version = "2.6.0"
|
||||
version = "2.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e68e84bfb01f0507134eac1e9b410a12ba379d064eab48c50ba4ce329a527b70"
|
||||
checksum = "16833386b02953ca926d19f64af613b9bf742c48dcd5e09b32fbfc9740bf84e2"
|
||||
dependencies = [
|
||||
"thiserror",
|
||||
"ucd-trie",
|
||||
@ -2254,9 +2270,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pest_derive"
|
||||
version = "2.6.0"
|
||||
version = "2.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b79d4c71c865a25a4322296122e3924d30bc8ee0834c8bfc8b95f7f054afbfb"
|
||||
checksum = "7763190f9406839f99e5197afee8c9e759969f7dbfa40ad3b8dbee8757b745b5"
|
||||
dependencies = [
|
||||
"pest",
|
||||
"pest_generator",
|
||||
@ -2264,9 +2280,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pest_generator"
|
||||
version = "2.6.0"
|
||||
version = "2.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c435bf1076437b851ebc8edc3a18442796b30f1728ffea6262d59bbe28b077e"
|
||||
checksum = "249061b22e99973da1f5f5f1410284419e283bb60b79255bf5f42a94b66a2e00"
|
||||
dependencies = [
|
||||
"pest",
|
||||
"pest_meta",
|
||||
@ -2277,9 +2293,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pest_meta"
|
||||
version = "2.6.0"
|
||||
version = "2.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "745a452f8eb71e39ffd8ee32b3c5f51d03845f99786fa9b68db6ff509c505411"
|
||||
checksum = "457c310cfc9cf3f22bc58901cc7f0d3410ac5d6298e432a4f9a6138565cb6df6"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"pest",
|
||||
@ -2448,9 +2464,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
version = "0.28.2"
|
||||
version = "0.29.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1"
|
||||
checksum = "81b9228215d82c7b61490fec1de287136b5de6f5700f6e58ea9ad61a7964ca51"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
@ -2670,18 +2686,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.163"
|
||||
version = "1.0.164"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2"
|
||||
checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.163"
|
||||
version = "1.0.164"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e"
|
||||
checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -2701,9 +2717,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.96"
|
||||
version = "1.0.97"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1"
|
||||
checksum = "bdf3bf93142acad5821c99197022e170842cdbc1c30482b98750c688c640842a"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
@ -2783,9 +2799,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "shadow-rs"
|
||||
version = "0.22.0"
|
||||
version = "0.23.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "157bef6b3029f72d6f4226acdfa466b84526aa62ae36a3bcf1e1801b403ecd74"
|
||||
checksum = "970538704756fd0bb4ec8cb89f80674afb661e7c0fe716f9ba5be57717742300"
|
||||
dependencies = [
|
||||
"const_format",
|
||||
"is_debug",
|
||||
@ -2896,7 +2912,7 @@ dependencies = [
|
||||
"pest",
|
||||
"pest_derive",
|
||||
"process_control",
|
||||
"quick-xml 0.28.2",
|
||||
"quick-xml 0.29.0",
|
||||
"rand",
|
||||
"rayon",
|
||||
"regex",
|
||||
@ -2927,9 +2943,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "starship-battery"
|
||||
version = "0.8.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "417551ac84efa1810d79d04555d36cbc83ec5a323f2ef9ee7318e34055461b6f"
|
||||
checksum = "cdba3bd6d6ead031f1ebf9dd84ebb02cfdbe5b0e51104b4befd0a2fc3d24f87b"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"core-foundation",
|
||||
|
22
Cargo.toml
22
Cargo.toml
@ -43,16 +43,16 @@ gix-faster = ["gix-features/zlib-stock", "gix/fast-sha1"]
|
||||
|
||||
[dependencies]
|
||||
chrono = { version = "0.4.26", default-features = false, features = ["clock", "std", "wasmbind"] }
|
||||
clap = { version = "4.3.2", features = ["derive", "cargo", "unicode"] }
|
||||
clap = { version = "4.3.4", features = ["derive", "cargo", "unicode"] }
|
||||
clap_complete = "4.3.1"
|
||||
dirs-next = "2.0.0"
|
||||
dunce = "1.0.4"
|
||||
gethostname = "0.4.3"
|
||||
# default feature restriction addresses https://github.com/starship/starship/issues/4251
|
||||
gix = { version = "0.45.1", default-features = false, features = ["max-performance-safe"] }
|
||||
gix = { version = "0.46.0", default-features = false, features = ["max-performance-safe"] }
|
||||
gix-features = { version = "0.30.0", optional = true }
|
||||
indexmap = { version = "1.9.3", features = ["serde"] }
|
||||
log = { version = "0.4.18", features = ["std"] }
|
||||
log = { version = "0.4.19", features = ["std"] }
|
||||
# notify-rust is optional (on by default) because the crate doesn't currently build for darwin with nix
|
||||
# see: https://github.com/NixOS/nixpkgs/issues/160876
|
||||
notify-rust = { version = "4.8.0", optional = true }
|
||||
@ -62,21 +62,21 @@ open = "4.1.0"
|
||||
# update os module config and tests when upgrading os_info
|
||||
os_info = "3.7.0"
|
||||
path-slash = "0.2.1"
|
||||
pest = "2.6.0"
|
||||
pest_derive = "2.6.0"
|
||||
quick-xml = "0.28.2"
|
||||
pest = "2.6.1"
|
||||
pest_derive = "2.6.1"
|
||||
quick-xml = "0.29.0"
|
||||
rand = "0.8.5"
|
||||
rayon = "1.7.0"
|
||||
regex = { version = "1.8.4", default-features = false, features = ["perf", "std", "unicode-perl"] }
|
||||
rust-ini = "0.19.0"
|
||||
semver = "1.0.17"
|
||||
serde = { version = "1.0.163", features = ["derive"] }
|
||||
serde_json = "1.0.96"
|
||||
serde = { version = "1.0.164", features = ["derive"] }
|
||||
serde_json = "1.0.97"
|
||||
sha1 = "0.10.5"
|
||||
shadow-rs = { version = "0.22.0", default-features = false }
|
||||
shadow-rs = { version = "0.23.0", default-features = false }
|
||||
# battery is optional (on by default) because the crate doesn't currently build for Termux
|
||||
# see: https://github.com/svartalf/rust-battery/issues/33
|
||||
starship-battery = { version = "0.8.0", optional = true }
|
||||
starship-battery = { version = "0.8.1", optional = true }
|
||||
strsim = "0.10.0"
|
||||
systemstat = "=0.2.3"
|
||||
terminal_size = "0.2.6"
|
||||
@ -117,7 +117,7 @@ features = [
|
||||
nix = { version = "0.26.2", default-features = false, features = ["feature", "fs", "user"] }
|
||||
|
||||
[build-dependencies]
|
||||
shadow-rs = { version = "0.22.0", default-features = false }
|
||||
shadow-rs = { version = "0.23.0", default-features = false }
|
||||
dunce = "1.0.4"
|
||||
|
||||
[target.'cfg(windows)'.build-dependencies]
|
||||
|
@ -225,7 +225,7 @@ Alternatively, install Starship using any of the following package managers:
|
||||
| _Any_ | [Linuxbrew] | `brew install starship` |
|
||||
| _Any_ | [Snapcraft] | `snap install --edge starship` |
|
||||
| Alpine Linux 3.13+ | [Alpine Linux Packages] | `apk add starship` |
|
||||
| Arch Linux | [Arch Linux Community] | `pacman -S starship` |
|
||||
| Arch Linux | [Arch Linux Extra] | `pacman -S starship` |
|
||||
| CentOS 7+ | [Copr] | `dnf copr enable atim/starship` <br /> `dnf install starship` |
|
||||
| Gentoo | [Gentoo Packages] | `emerge app-shells/starship` |
|
||||
| Manjaro | | `pacman -S starship` |
|
||||
@ -346,10 +346,10 @@ starship init nu | save -f ~/.cache/starship/init.nu
|
||||
And add the following to the end of your Nushell configuration (find it by running `$nu.config-path`):
|
||||
|
||||
```sh
|
||||
source ~/.cache/starship/init.nu
|
||||
use ~/.cache/starship/init.nu
|
||||
```
|
||||
|
||||
Note: Only Nushell v0.73+ is supported
|
||||
Note: Only Nushell v0.78+ is supported
|
||||
|
||||
</details>
|
||||
|
||||
@ -445,7 +445,7 @@ Copyright © 2019-present, [Starship Contributors](https://github.com/starship/s
|
||||
This project is [ISC](https://github.com/starship/starship/blob/master/LICENSE) licensed.
|
||||
|
||||
[alpine linux packages]: https://pkgs.alpinelinux.org/packages?name=starship
|
||||
[arch linux community]: https://archlinux.org/packages/community/x86_64/starship
|
||||
[arch linux extra]: https://archlinux.org/packages/extra/x86_64/starship
|
||||
[chocolatey]: https://community.chocolatey.org/packages/starship
|
||||
[conda-forge]: https://anaconda.org/conda-forge/starship
|
||||
[copr]: https://copr.fedorainfracloud.org/coprs/atim/starship
|
||||
|
@ -118,14 +118,14 @@ module.exports = defineConfig({
|
||||
["meta", { name: "twitter:alt", content: "Starship: Cross-Shell Prompt" }],
|
||||
// Google Analytics
|
||||
[
|
||||
'script',
|
||||
"script",
|
||||
{
|
||||
async: true,
|
||||
src: 'https://www.googletagmanager.com/gtag/js?id=G-N3M0VJ9NL6',
|
||||
src: "https://www.googletagmanager.com/gtag/js?id=G-N3M0VJ9NL6",
|
||||
},
|
||||
],
|
||||
[
|
||||
'script',
|
||||
"script",
|
||||
{},
|
||||
"window.dataLayer = window.dataLayer || [];\nfunction gtag(){dataLayer.push(arguments);}\ngtag('js', new Date());\ngtag('config', 'G-N3M0VJ9NL6');",
|
||||
],
|
||||
|
@ -138,7 +138,7 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
|
||||
::: warning
|
||||
|
||||
This will change in the future.
|
||||
Only Nushell v0.73+ is supported.
|
||||
Only Nushell v0.78+ is supported.
|
||||
|
||||
:::
|
||||
|
||||
@ -151,8 +151,9 @@ description: Starship is the minimal, blazing fast, and extremely customizable p
|
||||
And add the following to the end of your Nushell configuration (find it by running `$nu.config-path`):
|
||||
|
||||
```sh
|
||||
source ~/.cache/starship/init.nu
|
||||
use ~/.cache/starship/init.nu
|
||||
```
|
||||
|
||||
#### Xonsh
|
||||
|
||||
Add the following to the end of `~/.xonshrc`:
|
||||
|
@ -337,12 +337,13 @@ print_install() {
|
||||
nushell )
|
||||
# shellcheck disable=SC2088
|
||||
config_file="${BOLD}your nu config file${NO_COLOR} (find it by running ${BOLD}\$nu.config-path${NO_COLOR} in Nushell)"
|
||||
config_cmd="mkdir ~/.cache/starship
|
||||
starship init nu | save -f ~/.cache/starship/init.nu
|
||||
source ~/.cache/starship/init.nu"
|
||||
config_cmd="use ~/.cache/starship/init.nu"
|
||||
warning="${warning} This will change in the future.
|
||||
Only Nushell v0.73 or higher is supported.
|
||||
Add the following to the end of ${BOLD}your Nushell env file${NO_COLOR} (find it by running ${BOLD}\$nu.env-path${NO_COLOR} in Nushell): \"mkdir ~/.cache/starship; starship init nu | save -f ~/.cache/starship/init.nu\""
|
||||
Only Nushell v0.78 or higher is supported.
|
||||
Add the following to the end of ${BOLD}your Nushell env file${NO_COLOR} (find it by running ${BOLD}\$nu.env-path${NO_COLOR} in Nushell):
|
||||
|
||||
mkdir ~/.cache/starship
|
||||
starship init nu | save -f ~/.cache/starship/init.nu"
|
||||
;;
|
||||
esac
|
||||
printf " %s\n %s\n And add the following to the end of %s:\n\n\t%s\n\n" \
|
||||
|
@ -219,7 +219,7 @@ fn handle_toggle_configuration(doc: &mut Document, name: &str, key: &str) -> Res
|
||||
pub fn get_configuration(context: &Context) -> toml::Table {
|
||||
let starship_config = StarshipConfig::initialize(&context.get_config_path_os());
|
||||
|
||||
starship_config.config.unwrap_or(toml::Table::new())
|
||||
starship_config.config.unwrap_or_default()
|
||||
}
|
||||
|
||||
pub fn get_configuration_edit(context: &Context) -> Document {
|
||||
|
@ -37,6 +37,18 @@ starship_precmd() {
|
||||
STARSHIP_PIPE_STATUS=(${BP_PIPESTATUS[@]})
|
||||
fi
|
||||
|
||||
# Due to a bug in certain Bash versions, any external process launched
|
||||
# inside $PROMPT_COMMAND will be reported by `jobs` as a background job:
|
||||
#
|
||||
# [1] 42135 Done /bin/echo
|
||||
#
|
||||
# This is a workaround - we run `jobs` once to clear out any completed jobs
|
||||
# first, and then we run it again and count the number of jobs.
|
||||
#
|
||||
# More context: https://github.com/starship/starship/issues/5159
|
||||
# Original bug: https://lists.gnu.org/archive/html/bug-bash/2022-07/msg00117.html
|
||||
jobs &>/dev/null
|
||||
|
||||
local NUM_JOBS=0
|
||||
# Evaluate the number of jobs before running the preserved prompt command, so that tools
|
||||
# like z/autojump, which background certain jobs, do not cause spurious background jobs
|
||||
|
@ -1,27 +1,39 @@
|
||||
let-env STARSHIP_SHELL = "nu"
|
||||
let-env STARSHIP_SESSION_KEY = (random chars -l 16)
|
||||
let-env PROMPT_MULTILINE_INDICATOR = (^::STARSHIP:: prompt --continuation)
|
||||
# this file is both a valid
|
||||
# - overlay which can be loaded with `overlay use starship.nu`
|
||||
# - module which can be used with `use starship.nu`
|
||||
# - script which can be used with `source starship.nu`
|
||||
export-env { load-env {
|
||||
STARSHIP_SHELL: "nu"
|
||||
STARSHIP_SESSION_KEY: (random chars -l 16)
|
||||
PROMPT_MULTILINE_INDICATOR: (
|
||||
^::STARSHIP:: prompt --continuation
|
||||
)
|
||||
|
||||
# Does not play well with default character module.
|
||||
# TODO: Also Use starship vi mode indicators?
|
||||
let-env PROMPT_INDICATOR = ""
|
||||
# Does not play well with default character module.
|
||||
# TODO: Also Use starship vi mode indicators?
|
||||
PROMPT_INDICATOR: ""
|
||||
|
||||
let-env PROMPT_COMMAND = { ||
|
||||
# jobs are not supported
|
||||
let width = (term size).columns
|
||||
^::STARSHIP:: prompt $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)"
|
||||
}
|
||||
PROMPT_COMMAND: {||
|
||||
# jobs are not supported
|
||||
(
|
||||
^::STARSHIP:: prompt
|
||||
--cmd-duration $env.CMD_DURATION_MS
|
||||
$"--status=($env.LAST_EXIT_CODE)"
|
||||
--terminal-width (term size).columns
|
||||
)
|
||||
}
|
||||
|
||||
# Whether we have config items
|
||||
let has_config_items = (not ($env | get -i config | is-empty))
|
||||
config: ($env.config? | default {} | merge {
|
||||
render_right_prompt_on_last_line: true
|
||||
})
|
||||
|
||||
let-env config = if $has_config_items {
|
||||
$env.config | upsert render_right_prompt_on_last_line true
|
||||
} else {
|
||||
{render_right_prompt_on_last_line: true}
|
||||
}
|
||||
|
||||
let-env PROMPT_COMMAND_RIGHT = { ||
|
||||
let width = (term size).columns
|
||||
^::STARSHIP:: prompt --right $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)"
|
||||
}
|
||||
PROMPT_COMMAND_RIGHT: {||
|
||||
(
|
||||
^::STARSHIP:: prompt
|
||||
--right
|
||||
--cmd-duration $env.CMD_DURATION_MS
|
||||
$"--status=($env.LAST_EXIT_CODE)"
|
||||
--terminal-width (term size).columns
|
||||
)
|
||||
}
|
||||
}}
|
||||
|
@ -141,6 +141,10 @@ $null = New-Module starship {
|
||||
|
||||
$arguments += "--status=$($lastExitCodeForPrompt)"
|
||||
|
||||
if ([Microsoft.PowerShell.PSConsoleReadLine]::InViCommandMode()) {
|
||||
$arguments += "--keymap=vi"
|
||||
}
|
||||
|
||||
# Invoke Starship
|
||||
$promptText = if ($script:TransientPrompt) {
|
||||
$script:TransientPrompt = $false
|
||||
@ -206,6 +210,12 @@ $null = New-Module starship {
|
||||
)
|
||||
)
|
||||
|
||||
try {
|
||||
Set-PSReadLineOption -ViModeIndicator script -ViModeChangeHandler {
|
||||
[Microsoft.PowerShell.PSConsoleReadLine]::InvokePrompt()
|
||||
}
|
||||
} catch {}
|
||||
|
||||
Export-ModuleMember -Function @(
|
||||
"Enable-TransientPrompt"
|
||||
"Disable-TransientPrompt"
|
||||
|
@ -35,9 +35,9 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
||||
// We do some environment detection in src/init.rs to translate.
|
||||
// The result: in non-vi fish, keymap is always reported as "insert"
|
||||
let mode = match (&context.shell, keymap) {
|
||||
(Shell::Fish, "default") | (Shell::Zsh, "vicmd") | (Shell::Cmd, "vi") => {
|
||||
ShellEditMode::Normal
|
||||
}
|
||||
(Shell::Fish, "default")
|
||||
| (Shell::Zsh, "vicmd")
|
||||
| (Shell::Cmd | Shell::PowerShell, "vi") => ShellEditMode::Normal,
|
||||
(Shell::Fish, "visual") => ShellEditMode::Visual,
|
||||
(Shell::Fish, "replace") => ShellEditMode::Replace,
|
||||
(Shell::Fish, "replace_one") => ShellEditMode::ReplaceOne,
|
||||
@ -179,7 +179,7 @@ mod test {
|
||||
let expected_specified = Some(format!("{} ", Color::Green.bold().paint("V")));
|
||||
let expected_visual = Some(format!("{} ", Color::Yellow.bold().paint("❮")));
|
||||
let expected_replace = Some(format!("{} ", Color::Purple.bold().paint("❮")));
|
||||
let expected_replace_one = expected_replace.clone();
|
||||
let expected_replace_one = expected_replace.as_deref();
|
||||
let expected_other = Some(format!("{} ", Color::Green.bold().paint("❯")));
|
||||
|
||||
// fish keymap is default
|
||||
@ -219,7 +219,7 @@ mod test {
|
||||
.shell(Shell::Fish)
|
||||
.keymap("replace_one")
|
||||
.collect();
|
||||
assert_eq!(expected_replace_one, actual);
|
||||
assert_eq!(expected_replace_one, actual.as_deref());
|
||||
|
||||
// fish keymap is other
|
||||
let actual = ModuleRenderer::new("character")
|
||||
@ -260,4 +260,36 @@ mod test {
|
||||
.collect();
|
||||
assert_eq!(expected_other, actual);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn powershell_keymap() {
|
||||
let expected_vicmd = Some(format!("{} ", Color::Green.bold().paint("❮")));
|
||||
let expected_specified = Some(format!("{} ", Color::Green.bold().paint("V")));
|
||||
let expected_other = Some(format!("{} ", Color::Green.bold().paint("❯")));
|
||||
|
||||
// powershell keymap is vi
|
||||
let actual = ModuleRenderer::new("character")
|
||||
.shell(Shell::PowerShell)
|
||||
.keymap("vi")
|
||||
.collect();
|
||||
assert_eq!(expected_vicmd, actual);
|
||||
|
||||
// specified vicmd character
|
||||
let actual = ModuleRenderer::new("character")
|
||||
.config(toml::toml! {
|
||||
[character]
|
||||
vicmd_symbol = "[V](bold green)"
|
||||
})
|
||||
.shell(Shell::PowerShell)
|
||||
.keymap("vi")
|
||||
.collect();
|
||||
assert_eq!(expected_specified, actual);
|
||||
|
||||
// powershell keymap is other
|
||||
let actual = ModuleRenderer::new("character")
|
||||
.shell(Shell::PowerShell)
|
||||
.keymap("visual")
|
||||
.collect();
|
||||
assert_eq!(expected_other, actual);
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ mod tests {
|
||||
|
||||
macro_rules! get_hostname {
|
||||
() => {
|
||||
if let Some(hostname) = gethostname::gethostname().into_string().ok() {
|
||||
if let Ok(hostname) = gethostname::gethostname().into_string() {
|
||||
hostname
|
||||
} else {
|
||||
println!(
|
||||
|
@ -226,7 +226,7 @@ mod tests {
|
||||
"3.12.0",
|
||||
];
|
||||
|
||||
for input in inputs.iter() {
|
||||
for input in &inputs {
|
||||
assert_eq!(parse_version(input), expected);
|
||||
}
|
||||
}
|
||||
@ -243,7 +243,7 @@ mod tests {
|
||||
"3.12.0-alpha",
|
||||
];
|
||||
|
||||
for input in inputs.iter() {
|
||||
for input in &inputs {
|
||||
assert_eq!(parse_version(input), expected);
|
||||
}
|
||||
}
|
||||
@ -260,7 +260,7 @@ mod tests {
|
||||
"3.12.0-alpha.1630554544+f89e9a29.dirty",
|
||||
];
|
||||
|
||||
for input in inputs.iter() {
|
||||
for input in &inputs {
|
||||
assert_eq!(parse_version(input), expected);
|
||||
}
|
||||
}
|
||||
|
@ -60,10 +60,10 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
||||
fn parse_swift_version(swift_version: &str) -> Option<String> {
|
||||
// split into ["Apple", "Swift", "version", "5.2.2", ...] or
|
||||
// ["Swift", "version", "5.3-dev", ...]
|
||||
let mut splited = swift_version.split_whitespace();
|
||||
let _ = splited.position(|t| t == "version")?;
|
||||
let mut split = swift_version.split_whitespace();
|
||||
let _ = split.position(|t| t == "version")?;
|
||||
// return "5.2.2" or "5.3-dev"
|
||||
let version = splited.next()?;
|
||||
let version = split.next()?;
|
||||
|
||||
Some(version.to_string())
|
||||
}
|
||||
|
@ -7,5 +7,6 @@ esy = "esy"
|
||||
numver = "numver"
|
||||
afe = "afe"
|
||||
extentions = "extentions" # TODO: should be extensions
|
||||
worl = "worl" # typo on purpose
|
||||
[files]
|
||||
extend-exclude = ["CHANGELOG.md", "docs/*"]
|
||||
|
Loading…
Reference in New Issue
Block a user