Merge branch 'master' into conditional-style

This commit is contained in:
Filip Bachul 2023-05-02 11:19:36 +02:00
commit 65f9ff675c
16 changed files with 343 additions and 324 deletions

View File

@ -92,11 +92,9 @@ jobs:
uses: actions/checkout@v3
- name: Setup | Rust
uses: actions-rs/toolchain@v1.0.7
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
override: true
profile: minimal
target: ${{ matrix.target }}
- name: Setup | Install cargo-wix [Windows]
@ -108,20 +106,25 @@ jobs:
# cargo-wix does not require static crt
RUSTFLAGS: ""
- name: Build | Build
uses: actions-rs/cargo@v1.0.3
with:
command: build
args: --release --locked --target ${{ matrix.target }}
use-cross: ${{ matrix.os == 'ubuntu-latest' }}
- name: Setup | Install cross [Linux]
if: matrix.os == 'ubuntu-latest'
uses: taiki-e/install-action@cross
- name: Build | Build [Cargo]
if: matrix.os != 'ubuntu-latest'
run: cargo build --release --locked --target ${{ matrix.target }}
- name: Build | Build [Cross]
if: matrix.os == 'ubuntu-latest'
run: cross build --release --locked --target ${{ matrix.target }}
- name: Build | Installer [Windows]
continue-on-error: true
if: matrix.os == 'windows-latest' && matrix.target != 'aarch64-pc-windows-msvc'
uses: actions-rs/cargo@v1.0.3
with:
command: wix
args: -v --no-build --nocapture -I install/windows/main.wxs --target ${{ matrix.target }} --output target/wix/starship-${{ matrix.target }}.msi
run: >
cargo wix -v --no-build --nocapture -I install/windows/main.wxs
--target ${{ matrix.target }}
--output target/wix/starship-${{ matrix.target }}.msi
- name: Post Build | Prepare artifacts [Windows]
if: matrix.os == 'windows-latest'
@ -284,11 +287,7 @@ jobs:
uses: actions/checkout@v3
- name: Setup | Rust
uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
profile: minimal
override: true
uses: dtolnay/rust-toolchain@stable
- name: Build | Publish
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}

View File

@ -7,4 +7,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: crate-ci/typos@v1.14.6
- uses: crate-ci/typos@v1.14.8

View File

@ -27,11 +27,8 @@ jobs:
uses: actions/checkout@v3
- name: Setup | Rust
uses: actions-rs/toolchain@v1.0.7
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt
- name: Build | Format
@ -49,21 +46,15 @@ jobs:
uses: actions/checkout@v3
- name: Setup | Rust
uses: actions-rs/toolchain@v1.0.7
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
profile: minimal
components: clippy
- name: Setup | Cache
uses: Swatinem/rust-cache@v2
- name: Build | Lint
uses: actions-rs/cargo@v1.0.3
with:
command: clippy
args: --workspace --locked --all-targets --all-features -- -D clippy::all
uses: giraffate/clippy-action@871cc4173f2594435c7ea6b0bce499cf6c2164a1
# Ensure that the project could be successfully compiled
cargo_check:
@ -74,11 +65,7 @@ jobs:
uses: actions/checkout@v3
- name: Setup | Rust
uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
profile: minimal
override: true
uses: dtolnay/rust-toolchain@stable
- name: Setup | Cache
uses: Swatinem/rust-cache@v2
@ -96,11 +83,7 @@ jobs:
uses: actions/checkout@v3
- name: Setup | Rust
uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
profile: minimal
override: true
uses: dtolnay/rust-toolchain@stable
- name: Setup | Cache
uses: Swatinem/rust-cache@v2
@ -118,11 +101,7 @@ jobs:
uses: actions/checkout@v3
- name: Setup | Rust
uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
profile: minimal
override: true
uses: dtolnay/rust-toolchain@stable
- name: Setup | Cache
uses: Swatinem/rust-cache@v2
@ -144,11 +123,7 @@ jobs:
uses: actions/checkout@v3
- name: Setup | Rust
uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
profile: minimal
override: true
uses: dtolnay/rust-toolchain@stable
- name: Setup | Cache
uses: Swatinem/rust-cache@v2
@ -185,12 +160,10 @@ jobs:
# Install all the required dependencies for testing
- name: Setup | Rust
uses: actions-rs/toolchain@v1.0.7
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: llvm-tools-preview
profile: minimal
override: true
- name: Setup | Cache
uses: Swatinem/rust-cache@v2
@ -228,10 +201,7 @@ jobs:
- name: Build | Installer [Windows]
continue-on-error: true
if: matrix.os == 'windows-latest' && matrix.rust == 'stable'
uses: actions-rs/cargo@v1.0.3
with:
command: wix
args: --dbg-build -v --nocapture -I install/windows/main.wxs
run: cargo wix --dbg-build -v --nocapture -I install/windows/main.wxs
- name: Build | Chocolatey Package [Windows]
continue-on-error: true

342
Cargo.lock generated
View File

@ -33,9 +33,9 @@ dependencies = [
[[package]]
name = "aho-corasick"
version = "0.7.20"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
checksum = "e5bce8d450891e3b36f85a2230cec441fddd60e0c455b61b15bb3ffba955ca85"
dependencies = [
"memchr",
]
@ -244,6 +244,12 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24a6904aef64d73cf10ab17ebace7befb918b82164785cb89907993be7f83813"
[[package]]
name = "block"
version = "0.1.6"
@ -350,9 +356,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.2.3"
version = "4.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49f9152d70e42172fdb87de2efd7327160beee37886027cf86f30a233d5b30b4"
checksum = "8a1f23fa97e1d1641371b51f35535cb26959b8e27ab50d167a8b996b5bada819"
dependencies = [
"clap_builder",
"clap_derive",
@ -361,13 +367,13 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.2.3"
version = "4.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e067b220911598876eb55d52725ddcc201ffe3f0904018195973bc5b012ea2ca"
checksum = "0fdc5d93c358224b4d6867ef1356d740de2303e9892edc06c5340daeccd96bab"
dependencies = [
"anstream",
"anstyle",
"bitflags",
"bitflags 1.3.2",
"clap_lex",
"once_cell",
"strsim",
@ -377,9 +383,9 @@ dependencies = [
[[package]]
name = "clap_complete"
version = "4.2.0"
version = "4.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01c22dcfb410883764b29953103d9ef7bb8fe21b3fa1158bc99986c2067294bd"
checksum = "1a19591b2ab0e3c04b588a0e04ddde7b9eaa423646d1b4a8092879216bf47473"
dependencies = [
"clap",
]
@ -722,9 +728,9 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1"
[[package]]
name = "dunce"
version = "1.0.3"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bd4b30a6560bbd9b4620f4de34c3f14f60848e58a9b7216801afcb4c7b31c3c"
checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b"
[[package]]
name = "dyn-clone"
@ -959,9 +965,9 @@ dependencies = [
[[package]]
name = "gix"
version = "0.43.1"
version = "0.44.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c256ea71cc1967faaefdaad15f334146b7c806f12460dcafd3afed845c8c78dd"
checksum = "6bf41b61f7df395284f7a579c0fa1a7e012c5aede655174d4e91299ef1cac643"
dependencies = [
"gix-actor",
"gix-attributes",
@ -970,10 +976,12 @@ dependencies = [
"gix-date",
"gix-diff",
"gix-discover",
"gix-features 0.28.1",
"gix-features",
"gix-fs",
"gix-glob",
"gix-hash 0.10.4",
"gix-hash",
"gix-hashtable",
"gix-ignore",
"gix-index",
"gix-lock",
"gix-mailmap",
@ -989,6 +997,7 @@ dependencies = [
"gix-tempfile",
"gix-traverse",
"gix-url",
"gix-utils",
"gix-validate",
"gix-worktree",
"log",
@ -1001,9 +1010,9 @@ dependencies = [
[[package]]
name = "gix-actor"
version = "0.19.0"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc22b0cdc52237667c301dd7cdc6ead8f8f73c9f824e9942c8ebd6b764f6c0bf"
checksum = "848efa0f1210cea8638f95691c82a46f98a74b9e3524f01d4955ebc25a8f84f3"
dependencies = [
"bstr",
"btoi",
@ -1015,24 +1024,26 @@ dependencies = [
[[package]]
name = "gix-attributes"
version = "0.10.0"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2231a25934a240d0a4b6f4478401c73ee81d8be52de0293eedbc172334abf3e1"
checksum = "3015baa01ad2122fbcaab7863c857a603eb7b7ec12ac8141207c42c6439805e2"
dependencies = [
"bstr",
"gix-features 0.28.1",
"gix-glob",
"gix-path",
"gix-quote",
"kstring",
"log",
"smallvec",
"thiserror",
"unicode-bom",
]
[[package]]
name = "gix-bitmap"
version = "0.2.2"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "024bca0c7187517bda5ea24ab148c9ca8208dd0c3e2bea88cdb2008f91791a6d"
checksum = "55a95f4942360766c3880bdb2b4b57f1ef73b190fc424755e7fdf480430af618"
dependencies = [
"thiserror",
]
@ -1057,13 +1068,13 @@ dependencies = [
[[package]]
name = "gix-config"
version = "0.20.1"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fbad5ce54a8fc997acc50febd89ec80fa6e97cb7f8d0654cb229936407489d8"
checksum = "1d252a0eddb6df74600d3d8872dc9fe98835a7da43110411d705b682f49d4ac1"
dependencies = [
"bstr",
"gix-config-value",
"gix-features 0.28.1",
"gix-features",
"gix-glob",
"gix-path",
"gix-ref",
@ -1079,11 +1090,11 @@ dependencies = [
[[package]]
name = "gix-config-value"
version = "0.10.2"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d09154c0c8677e4da0ec35e896f56ee3e338e741b9599fae06075edd83a4081c"
checksum = "786861e84a5793ad5f863d846de5eb064cd23b87e61ad708c8c402608202e7be"
dependencies = [
"bitflags",
"bitflags 2.2.1",
"bstr",
"gix-path",
"libc",
@ -1092,9 +1103,9 @@ dependencies = [
[[package]]
name = "gix-credentials"
version = "0.12.0"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "750b684197374518ea057e0a0594713e07683faa0a3f43c0f93d97f64130ad8d"
checksum = "4874a4fc11ffa844a3c2b87a66957bda30a73b577ef1acf15ac34df5745de5ff"
dependencies = [
"bstr",
"gix-command",
@ -1108,9 +1119,9 @@ dependencies = [
[[package]]
name = "gix-date"
version = "0.4.3"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b96271912ce39822501616f177dea7218784e6c63be90d5f36322ff3a722aae2"
checksum = "99056f37270715f5c7584fd8b46899a2296af9cae92463bf58b8bd1f5a78e553"
dependencies = [
"bstr",
"itoa",
@ -1120,11 +1131,11 @@ dependencies = [
[[package]]
name = "gix-diff"
version = "0.28.1"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "103a0fa79b0d438f5ecb662502f052e530ace4fe1fe8e1c83c0c6da76d728e67"
checksum = "644a0f2768bc42d7a69289ada80c9e15c589caefc6a315d2307202df83ed1186"
dependencies = [
"gix-hash 0.10.4",
"gix-hash",
"gix-object",
"imara-diff",
"thiserror",
@ -1132,13 +1143,13 @@ dependencies = [
[[package]]
name = "gix-discover"
version = "0.16.2"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6eba8ba458cb8f4a6c33409b0fe650b1258655175a7ffd1d24fafd3ed31d880b"
checksum = "5012710ebdecf6193c6866d6409a3b702a4aa0d78c605bc343590b44ab9962a1"
dependencies = [
"bstr",
"dunce",
"gix-hash 0.10.4",
"gix-hash",
"gix-path",
"gix-ref",
"gix-sec",
@ -1147,14 +1158,14 @@ dependencies = [
[[package]]
name = "gix-features"
version = "0.28.1"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b76f9a80f6dd7be66442ae86e1f534effad9546676a392acc95e269d0c21c22"
checksum = "cf69b0f5c701cc3ae22d3204b671907668f6437ca88862d355eaf9bc47a4f897"
dependencies = [
"crc32fast",
"crossbeam-channel",
"flate2",
"gix-hash 0.10.4",
"gix-hash",
"jwalk",
"libc",
"once_cell",
@ -1167,42 +1178,31 @@ dependencies = [
]
[[package]]
name = "gix-features"
version = "0.29.0"
name = "gix-fs"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf69b0f5c701cc3ae22d3204b671907668f6437ca88862d355eaf9bc47a4f897"
checksum = "9b37a1832f691fdc09910bd267f9a2e413737c1f9ec68c6e31f9e802616278a9"
dependencies = [
"flate2",
"gix-hash 0.11.0",
"libc",
"thiserror",
"gix-features",
]
[[package]]
name = "gix-glob"
version = "0.5.5"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93e43efd776bc543f46f0fd0ca3d920c37af71a764a16f2aebd89765e9ff2993"
checksum = "c07c98204529ac3f24b34754540a852593d2a4c7349008df389240266627a72a"
dependencies = [
"bitflags",
"bitflags 2.2.1",
"bstr",
"gix-features",
"gix-path",
]
[[package]]
name = "gix-hash"
version = "0.10.4"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a258595457bc192d1f1c59d0d168a1e34e2be9b97a614e14995416185de41a7"
dependencies = [
"hex",
"thiserror",
]
[[package]]
name = "gix-hash"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e6692709eafc9ba8cefef657144fb4170eef1351dc44b7cc873d80ce46db370"
checksum = "078eec3ac2808cc03f0bddd2704cb661da5c5dc33b41a9d7947b141d499c7c42"
dependencies = [
"hex",
"thiserror",
@ -1210,28 +1210,40 @@ dependencies = [
[[package]]
name = "gix-hashtable"
version = "0.1.3"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4e55e40dfd694884f0eb78796c5bddcf2f8b295dace47039099dd7e76534973"
checksum = "afebb85691c6a085b114e01a27f4a61364519298c5826cb87a45c304802299bc"
dependencies = [
"gix-hash 0.10.4",
"gix-hash",
"hashbrown 0.13.2",
"parking_lot",
]
[[package]]
name = "gix-index"
version = "0.15.1"
name = "gix-ignore"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "717ab601ece7921f59fe86849dbe27d44a46ebb883b5885732c4f30df4996177"
checksum = "ba205b6df563e2906768bb22834c82eb46c5fdfcd86ba2c347270bc8309a05b2"
dependencies = [
"bitflags",
"bstr",
"gix-glob",
"gix-path",
"unicode-bom",
]
[[package]]
name = "gix-index"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa282756760f79c401d4f4f42588fbb4aa27bbb4b0830f3b4d3480c21a4ac5a7"
dependencies = [
"bitflags 2.2.1",
"bstr",
"btoi",
"filetime",
"gix-bitmap",
"gix-features 0.28.1",
"gix-hash 0.10.4",
"gix-features",
"gix-hash",
"gix-lock",
"gix-object",
"gix-traverse",
@ -1254,9 +1266,9 @@ dependencies = [
[[package]]
name = "gix-mailmap"
version = "0.11.0"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b66aea5e52875cd4915f4957a6f4b75831a36981e2ec3f5fad9e370e444fe1a"
checksum = "e8856cec3bdc3610c06970d28b6cb20a0c6621621cf9a8ec48cbd23f2630f362"
dependencies = [
"bstr",
"gix-actor",
@ -1265,15 +1277,15 @@ dependencies = [
[[package]]
name = "gix-object"
version = "0.28.0"
version = "0.29.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8df068db9180ee935fbb70504848369e270bdcb576b05c0faa8b9fd3b86fc017"
checksum = "c9bb30ce0818d37096daa29efe361a4bc6dd0b51a5726598898be7e9a40a01e1"
dependencies = [
"bstr",
"btoi",
"gix-actor",
"gix-features 0.28.1",
"gix-hash 0.10.4",
"gix-features",
"gix-hash",
"gix-validate",
"hex",
"itoa",
@ -1284,13 +1296,13 @@ dependencies = [
[[package]]
name = "gix-odb"
version = "0.43.1"
version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e83af2e3e36005bfe010927f0dff41fb5acc3e3d89c6f1174135b3a34086bda2"
checksum = "bca2f324aa67672b6d0f2c0fa93f96eb6a7029d260e4c1df5dce3c015f5e5add"
dependencies = [
"arc-swap",
"gix-features 0.28.1",
"gix-hash 0.10.4",
"gix-features",
"gix-hash",
"gix-object",
"gix-pack",
"gix-path",
@ -1302,15 +1314,15 @@ dependencies = [
[[package]]
name = "gix-pack"
version = "0.33.2"
version = "0.35.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9401911c7fe032ad7b31c6a6b5be59cb283d1d6c999417a8215056efe6d635f3"
checksum = "164a515900a83257ae4aa80e741655bee7a2e39113fb535d7a5ac623b445ff20"
dependencies = [
"clru",
"gix-chunk",
"gix-diff",
"gix-features 0.28.1",
"gix-hash 0.10.4",
"gix-features",
"gix-hash",
"gix-hashtable",
"gix-object",
"gix-path",
@ -1325,24 +1337,26 @@ dependencies = [
[[package]]
name = "gix-path"
version = "0.7.3"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32370dce200bb951df013e03dff35b4233fc7a89458642b047629b91734a7e19"
checksum = "4fc78f47095a0c15aea0e66103838f0748f4494bf7a9555dfe0f00425400396c"
dependencies = [
"bstr",
"home",
"once_cell",
"thiserror",
]
[[package]]
name = "gix-prompt"
version = "0.3.3"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f3034d4d935aef2c7bf719aaa54b88c520e82413118d886ae880a31d5bdee57"
checksum = "330d11fdf88fff3366c2491efde2f3e454958efe7d5ddf60272e8fb1d944bb01"
dependencies = [
"gix-command",
"gix-config-value",
"nix",
"parking_lot",
"rustix",
"thiserror",
]
@ -1359,13 +1373,14 @@ dependencies = [
[[package]]
name = "gix-ref"
version = "0.27.2"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4e909396ed3b176823991ccc391c276ae2a015e54edaafa3566d35123cfac9d"
checksum = "b8212ecfe41815a2f1b059d82171d6276758cfac5506a5e0f04ad45ef0b1924a"
dependencies = [
"gix-actor",
"gix-features 0.28.1",
"gix-hash 0.10.4",
"gix-features",
"gix-fs",
"gix-hash",
"gix-lock",
"gix-object",
"gix-path",
@ -1378,12 +1393,12 @@ dependencies = [
[[package]]
name = "gix-refspec"
version = "0.9.0"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aba332462bda2e8efeae4302b39a6ed01ad56ef772fd5b7ef197cf2798294d65"
checksum = "0a6ea733820df67e4cd7797deb12727905824d8f5b7c59d943c456d314475892"
dependencies = [
"bstr",
"gix-hash 0.10.4",
"gix-hash",
"gix-revision",
"gix-validate",
"smallvec",
@ -1392,13 +1407,13 @@ dependencies = [
[[package]]
name = "gix-revision"
version = "0.12.2"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c6f6ff53f888858afc24bf12628446a14279ceec148df6194481f306f553ad2"
checksum = "810f35e9afeccca999d5d348b239f9c162353127d2e13ff3240e31b919e35476"
dependencies = [
"bstr",
"gix-date",
"gix-hash 0.10.4",
"gix-hash",
"gix-hashtable",
"gix-object",
"thiserror",
@ -1406,15 +1421,14 @@ dependencies = [
[[package]]
name = "gix-sec"
version = "0.6.2"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8ffa5bf0772f9b01de501c035b6b084cf9b8bb07dec41e3afc6a17336a65f47"
checksum = "794520043d5a024dfeac335c6e520cb616f6963e30dab995892382e998c12897"
dependencies = [
"bitflags",
"dirs",
"bitflags 2.2.1",
"gix-path",
"libc",
"windows 0.43.0",
"windows 0.48.0",
]
[[package]]
@ -1433,11 +1447,11 @@ dependencies = [
[[package]]
name = "gix-traverse"
version = "0.24.0"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd9a4a07bb22168dc79c60e1a6a41919d198187ca83d8a5940ad8d7122a45df3"
checksum = "a5be1e807f288c33bb005075111886cceb43ed8a167b3182a0f62c186e2a0dd1"
dependencies = [
"gix-hash 0.10.4",
"gix-hash",
"gix-hashtable",
"gix-object",
"thiserror",
@ -1445,18 +1459,27 @@ dependencies = [
[[package]]
name = "gix-url"
version = "0.16.0"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6a22b4b32ad14d68f7b7fb6458fa58d44b01797d94c1b8f4db2d9c7b3c366b5"
checksum = "dfc77f89054297cc81491e31f1bab4027e554b5ef742a44bd7035db9a0f78b76"
dependencies = [
"bstr",
"gix-features 0.28.1",
"gix-features",
"gix-path",
"home",
"thiserror",
"url",
]
[[package]]
name = "gix-utils"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c10b69beac219acb8df673187a1f07dde2d74092f974fb3f9eb385aeb667c909"
dependencies = [
"fastrand",
]
[[package]]
name = "gix-validate"
version = "0.7.4"
@ -1469,15 +1492,18 @@ dependencies = [
[[package]]
name = "gix-worktree"
version = "0.15.2"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54ec9a000b4f24af706c3cc680c7cda235656cbe3216336522f5692773b8a301"
checksum = "10bf56a1f5037d84293ea6cece61d9f27c4866b1e13c1c95f37cf56b7da7af25"
dependencies = [
"bstr",
"filetime",
"gix-attributes",
"gix-features 0.28.1",
"gix-features",
"gix-fs",
"gix-glob",
"gix-hash 0.10.4",
"gix-hash",
"gix-ignore",
"gix-index",
"gix-object",
"gix-path",
@ -1550,11 +1576,11 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "home"
version = "0.5.4"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "747309b4b440c06d57b0b25f2aee03ee9b5e5397d288c60e21fc709bb98a7408"
checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb"
dependencies = [
"winapi",
"windows-sys 0.48.0",
]
[[package]]
@ -1713,6 +1739,15 @@ dependencies = [
"rayon",
]
[[package]]
name = "kstring"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec3066350882a1cd6d950d055997f379ac37fd39f81cd4d8ed186032eb3c5747"
dependencies = [
"static_assertions",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
@ -1769,9 +1804,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "linux-raw-sys"
version = "0.3.1"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f"
checksum = "36eb31c1778188ae1e64398743890d0877fef36d11521ac60406b42016e8c2cf"
[[package]]
name = "lock_api"
@ -1910,7 +1945,7 @@ version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"cfg-if",
"libc",
"memoffset 0.7.1",
@ -2058,9 +2093,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "open"
version = "4.0.2"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "873240a4a404d44c8cd1bf394359245d466a5695771fea15a79cafbc5e5cf4d7"
checksum = "d16814a067484415fda653868c9be0ac5f2abd2ef5d951082a5f2fe1b3662944"
dependencies = [
"is-wsl",
"pathdiff",
@ -2165,9 +2200,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
[[package]]
name = "pest"
version = "2.5.7"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b1403e8401ad5dedea73c626b99758535b342502f8d1e361f4a2dd952749122"
checksum = "e68e84bfb01f0507134eac1e9b410a12ba379d064eab48c50ba4ce329a527b70"
dependencies = [
"thiserror",
"ucd-trie",
@ -2175,9 +2210,9 @@ dependencies = [
[[package]]
name = "pest_derive"
version = "2.5.7"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be99c4c1d2fc2769b1d00239431d711d08f6efedcecb8b6e30707160aee99c15"
checksum = "6b79d4c71c865a25a4322296122e3924d30bc8ee0834c8bfc8b95f7f054afbfb"
dependencies = [
"pest",
"pest_generator",
@ -2185,9 +2220,9 @@ dependencies = [
[[package]]
name = "pest_generator"
version = "2.5.7"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e56094789873daa36164de2e822b3888c6ae4b4f9da555a1103587658c805b1e"
checksum = "6c435bf1076437b851ebc8edc3a18442796b30f1728ffea6262d59bbe28b077e"
dependencies = [
"pest",
"pest_meta",
@ -2198,9 +2233,9 @@ dependencies = [
[[package]]
name = "pest_meta"
version = "2.5.7"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6733073c7cff3d8459fda0e42f13a047870242aed8b509fe98000928975f359e"
checksum = "745a452f8eb71e39ffd8ee32b3c5f51d03845f99786fa9b68db6ff509c505411"
dependencies = [
"once_cell",
"pest",
@ -2270,7 +2305,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4be1c66a6add46bff50935c313dae30a5030cf8385c5206e8a95e9e9def974aa"
dependencies = [
"autocfg",
"bitflags",
"bitflags 1.3.2",
"cfg-if",
"concurrent-queue",
"libc",
@ -2437,7 +2472,7 @@ version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
dependencies = [
"bitflags",
"bitflags 1.3.2",
]
[[package]]
@ -2446,7 +2481,7 @@ version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
dependencies = [
"bitflags",
"bitflags 1.3.2",
]
[[package]]
@ -2462,9 +2497,9 @@ dependencies = [
[[package]]
name = "regex"
version = "1.7.3"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d"
checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370"
dependencies = [
"aho-corasick",
"memchr",
@ -2479,9 +2514,9 @@ checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
[[package]]
name = "regex-syntax"
version = "0.6.29"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c"
[[package]]
name = "rust-ini"
@ -2495,11 +2530,11 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.37.11"
version = "0.37.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85597d61f83914ddeba6a47b3b8ffe7365107221c2e557ed94426489fefb5f77"
checksum = "f79bef90eb6d984c72722595b5b1348ab39275a5e5123faca6863bf07d75a4e0"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"errno 0.3.1",
"io-lifetimes",
"libc",
@ -2795,7 +2830,7 @@ dependencies = [
"dunce",
"gethostname",
"gix",
"gix-features 0.29.0",
"gix-features",
"guess_host_triple",
"home",
"indexmap",
@ -3005,7 +3040,7 @@ checksum = "31ef6892cc0348a9b3b8c377addba91e0f6365863d92354bf27559dca81ee8c5"
dependencies = [
"anyhow",
"base64",
"bitflags",
"bitflags 1.3.2",
"cfg-if",
"filedescriptor",
"hex",
@ -3217,9 +3252,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
[[package]]
name = "unicode-bom"
version = "1.1.4"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63ec69f541d875b783ca40184d655f2927c95f0bffd486faa83cd3ac3529ec32"
checksum = "98e90c70c9f0d4d1ee6d0a7d04aa06cb9bbd53d8cfbdd62a0269a7c2eb640552"
[[package]]
name = "unicode-ident"
@ -3449,21 +3484,6 @@ dependencies = [
"windows_x86_64_msvc 0.39.0",
]
[[package]]
name = "windows"
version = "0.43.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04662ed0e3e5630dfa9b26e4cb823b817f1a9addda855d973a9458c236556244"
dependencies = [
"windows_aarch64_gnullvm 0.42.2",
"windows_aarch64_msvc 0.42.2",
"windows_i686_gnu 0.42.2",
"windows_i686_msvc 0.42.2",
"windows_x86_64_gnu 0.42.2",
"windows_x86_64_gnullvm 0.42.2",
"windows_x86_64_msvc 0.42.2",
]
[[package]]
name = "windows"
version = "0.48.0"

View File

@ -43,13 +43,13 @@ gix-faster = ["gix-features/zlib-stock", "gix/fast-sha1"]
[dependencies]
chrono = { version = "0.4.24", default-features = false, features = ["clock", "std", "wasmbind"] }
clap = { version = "4.2.3", features = ["derive", "cargo", "unicode"] }
clap_complete = "4.2.0"
clap = { version = "4.2.5", features = ["derive", "cargo", "unicode"] }
clap_complete = "4.2.1"
dirs-next = "2.0.0"
dunce = "1.0.3"
dunce = "1.0.4"
gethostname = "0.4.2"
# default feature restriction addresses https://github.com/starship/starship/issues/4251
gix = { version = "0.43.1", default-features = false, features = ["max-performance-safe"] }
gix = { version = "0.44.1", default-features = false, features = ["max-performance-safe"] }
gix-features = { version = "0.29.0", optional = true }
indexmap = { version = "1.9.3", features = ["serde"] }
log = { version = "0.4.17", features = ["std"] }
@ -58,16 +58,16 @@ log = { version = "0.4.17", features = ["std"] }
notify-rust = { version = "4.8.0", optional = true }
nu-ansi-term = "0.47.0"
once_cell = "1.17.1"
open = "4.0.2"
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.5.7"
pest_derive = "2.5.7"
pest = "2.6.0"
pest_derive = "2.6.0"
quick-xml = "0.28.2"
rand = "0.8.5"
rayon = "1.7.0"
regex = "1.7.3"
regex = "1.8.1"
rust-ini = "0.18.0"
semver = "1.0.17"
serde = { version = "1.0.160", features = ["derive"] }
@ -92,7 +92,7 @@ yaml-rust = "0.4.5"
process_control = { version = "4.0.3", features = ["crossbeam-channel"] }
guess_host_triple = "0.1.3"
home = "0.5.4"
home = "0.5.5"
shell-words = "1.1.0"
[dependencies.schemars]
@ -118,7 +118,7 @@ nix = { version = "0.26.2", default-features = false, features = ["feature", "fs
[build-dependencies]
shadow-rs = { version = "0.21.0", default-features = false }
dunce = "1.0.3"
dunce = "1.0.4"
[target.'cfg(windows)'.build-dependencies]
winres = "0.1.12"

View File

@ -114,6 +114,14 @@
alt="Русский"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/uk-UA/guide/README.md"
><img
height="20"
src="https://raw.githubusercontent.com/starship/starship/master/media/flag-ua.png"
alt="Українська"
/></a>
&nbsp;
<a
href="https://github.com/starship/starship/blob/master/docs/vi-VN/guide/README.md"
><img

View File

@ -74,6 +74,11 @@ module.exports = defineConfig({
title: "Starship",
description: "Минималистичная, быстрая и бесконечно настраиваемая командная строка для любой оболочки!",
},
"/uk-UA/": {
lang: "uk-UA",
title: "Starship",
description: "Простий, супер швидкий та безмежно адаптивний командний рядок для будь-якої оболонки!",
},
"/vi-VN/": {
lang: "vi-VN",
title: "Starship",
@ -276,6 +281,25 @@ module.exports = defineConfig({
faq: "Часто Задаваемые Вопросы",
}),
},
"/uk-UA/": {
// text for the language dropdown
selectText: "Мови",
// label for this locale in the language dropdown
label: "Українська",
// Custom text for edit link. Defaults to "Edit this page"
editLinkText: "Редагувати цю сторінку на GitHub",
// Custom navbar values
nav: [{ text: "Налаштування", link: "/uk-UA/config/" }],
// Custom sidebar values
sidebar: sidebar("uk-UA", {
guide: "Керівництво",
installing: "Розширене встановлення",
config: "Налаштування",
"advanced-config": "Розширені налаштування",
faq: "Часті питання",
presets: "Шаблони",
}),
},
"/vi-VN/": {
// text for the language dropdown
selectText: "Ngôn ngữ",

View File

@ -164,7 +164,7 @@ format = '\[[$symbol($version)]($style)\]'
format = '\[[$symbol$environment]($style)\]'
[sudo]
format = '\[[as $symbol]\]'
format = '\[[as $symbol]($style)\]'
[swift]
format = '\[[$symbol($version)]($style)\]'

View File

@ -245,7 +245,7 @@ You can also set a similar output with PowerShell by creating a function named `
```powershell
# edit $PROFILE
function Invoke-Starship-PreCommand {
$host.ui.Write("`e]0; PS> $env:USERNAME@$env:COMPUTERNAME`: $pwd `a")
$host.ui.RawUI.WindowTitle = "$env:USERNAME@$env:COMPUTERNAME`: $pwd `a"
}
Invoke-Expression (&starship init powershell)

BIN
media/flag-ua.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

View File

@ -74,12 +74,20 @@ parts:
snapcraftctl build
snapcraftctl set-version $(git -C ../src describe --tags | sed 's/v//')
plugs:
starship-config:
interfaces: personal-files
write:
- $HOME/.config/starship.toml
- $HOME/.cache/starship
apps:
starship:
command: bin/starship
plugs:
- home
- removable-media
- starship-config
architectures:
- build-on: amd64

View File

@ -182,6 +182,15 @@ impl<'a> Context<'a> {
}
}
/// Sets the context config, overwriting the existing config
pub fn set_config(mut self, config: toml::Table) -> Context<'a> {
self.root_config = StarshipRootConfig::load(&config);
self.config = StarshipConfig {
config: Some(config),
};
self
}
// Tries to retrieve home directory from a table in testing mode or else retrieves it from the os
pub fn get_home(&self) -> Option<PathBuf> {
home_dir(&self.env)
@ -256,7 +265,7 @@ impl<'a> Context<'a> {
git_sec::trust::Mapping::<gix::open::Options>::default();
// don't use the global git configs
let config = gix::permissions::Config {
let config = gix::open::permissions::Config {
git_binary: false,
system: false,
git: false,
@ -266,14 +275,17 @@ impl<'a> Context<'a> {
};
// change options for config permissions without touching anything else
git_open_opts_map.reduced =
git_open_opts_map.reduced.permissions(gix::Permissions {
git_open_opts_map
.reduced
.permissions(gix::open::Permissions {
config,
..gix::open::Permissions::default_for_level(git_sec::Trust::Reduced)
});
git_open_opts_map.full =
git_open_opts_map.full.permissions(gix::open::Permissions {
config,
..gix::Permissions::default_for_level(git_sec::Trust::Reduced)
..gix::open::Permissions::default_for_level(git_sec::Trust::Full)
});
git_open_opts_map.full = git_open_opts_map.full.permissions(gix::Permissions {
config,
..gix::Permissions::default_for_level(git_sec::Trust::Full)
});
let shared_repo =
match ThreadSafeRepository::discover_with_environment_overrides_opts(
@ -790,6 +802,7 @@ fn parse_width(width: &str) -> Result<usize, ParseIntError> {
#[cfg(test)]
mod tests {
use super::*;
use crate::test::default_context;
use std::io;
fn testdir(paths: &[&str]) -> Result<tempfile::TempDir, std::io::Error> {
@ -981,6 +994,16 @@ mod tests {
assert_eq!(expected_logical_dir, context.logical_dir);
}
#[test]
fn set_config_method_overwrites_constructor() {
let context = default_context();
let mod_context = default_context().set_config(toml::toml! {
add_newline = true
});
assert_ne!(context.config.config, mod_context.config.config);
}
#[cfg(windows)]
#[test]
fn strip_extended_path_prefix() {

View File

@ -91,6 +91,7 @@ impl<'a> StyleVariableHolder<Cow<'a, str>> for Vec<FormatElement<'a>> {
self.iter().fold(BTreeSet::new(), |mut acc, el| match el {
FormatElement::TextGroup(textgroup) => {
acc.extend(textgroup.style.get_style_variables());
acc.extend(textgroup.format.get_style_variables());
acc
}
FormatElement::Conditional(format) => {

View File

@ -569,6 +569,30 @@ mod tests {
match_next!(result_iter, "inner", inner_style);
}
#[test]
fn test_style_variable_nested() {
const STYLE_VAR_NAME: &str = "style";
let format_string = format!("[[text](${STYLE_VAR_NAME})](blue)");
let inner_style = Some(Color::Red.bold());
let formatter = StringFormatter::new(&format_string)
.unwrap()
.map_style(|variable| match variable {
STYLE_VAR_NAME => Some(Ok("red bold".to_owned())),
_ => None,
});
assert_eq!(
BTreeSet::from([STYLE_VAR_NAME.into()]),
formatter.get_style_variables()
);
let result = formatter.parse(None, None).unwrap();
let mut result_iter = result.iter();
match_next!(result_iter, "text", inner_style);
}
#[test]
fn test_styled_variable_as_text() {
const FORMAT_STR: &str = "[$var](red bold)";

View File

@ -493,24 +493,18 @@ fn preset_list() -> String {
#[cfg(test)]
mod test {
use super::*;
use crate::config::StarshipConfig;
use crate::test::default_context;
use crate::utils;
#[test]
fn main_prompt() {
let mut context = default_context();
context.config = StarshipConfig {
config: Some(toml::toml! {
let mut context = default_context().set_config(toml::toml! {
add_newline=false
format="$character"
[character]
format=">\n>"
}),
};
context.root_config.format = "$character".to_string();
});
context.target = Target::Main;
context.root_config.add_newline = false;
let expected = String::from(">\n>");
let actual = get_prompt(context);
@ -519,15 +513,11 @@ mod test {
#[test]
fn right_prompt() {
let mut context = default_context();
context.config = StarshipConfig {
config: Some(toml::toml! {
let mut context = default_context().set_config(toml::toml! {
right_format="$character"
[character]
format=">\n>"
}),
};
context.root_config.right_format = "$character".to_string();
});
context.target = Target::Right;
let expected = String::from(">>"); // should strip new lines
@ -537,22 +527,14 @@ mod test {
#[test]
fn custom_prompt() {
let mut context = default_context();
context.config = StarshipConfig {
config: Some(toml::toml! {
let mut context = default_context().set_config(toml::toml! {
add_newline = false
[profiles]
test="0_0$character"
[character]
format=">>"
}),
};
context
.root_config
.profiles
.insert("test".to_string(), "0_0$character".to_string());
});
context.target = Target::Profile("test".to_string());
context.root_config.add_newline = false;
let expected = String::from("0_0>>");
let actual = get_prompt(context);
@ -561,22 +543,14 @@ mod test {
#[test]
fn custom_prompt_fallback() {
let mut context = default_context();
context.config = StarshipConfig {
config: Some(toml::toml! {
let mut context = default_context().set_config(toml::toml! {
add_newline=false
[profiles]
test="0_0$character"
[character]
format=">>"
}),
};
context
.root_config
.profiles
.insert("test".to_string(), "0_0$character".to_string());
});
context.target = Target::Profile("wrong_prompt".to_string());
context.root_config.add_newline = false;
let expected = String::from(">");
let actual = get_prompt(context);
@ -585,13 +559,9 @@ mod test {
#[test]
fn continuation_prompt() {
let mut context = default_context();
context.config = StarshipConfig {
config: Some(toml::toml! {
let mut context = default_context().set_config(toml::toml! {
continuation_prompt="><>"
}),
};
context.root_config.continuation_prompt = "><>".to_string();
});
context.target = Target::Continuation;
let expected = String::from("><>");
@ -634,10 +604,7 @@ mod test {
#[test]
fn custom_expands() -> std::io::Result<()> {
let dir = tempfile::tempdir()?;
let mut context = default_context();
context.current_dir = dir.path().to_path_buf();
context.config = StarshipConfig {
config: Some(toml::toml! {
let mut context = default_context().set_config(toml::toml! {
format="$custom"
[custom.a]
when=true
@ -645,9 +612,8 @@ mod test {
[custom.b]
when=true
format="b"
}),
};
context.root_config.format = "$custom".to_string();
});
context.current_dir = dir.path().to_path_buf();
let expected = String::from("\nab");
let actual = get_prompt(context);
@ -657,9 +623,7 @@ mod test {
#[test]
fn env_expands() {
let mut context = default_context();
context.config = StarshipConfig {
config: Some(toml::toml! {
let mut context = default_context().set_config(toml::toml! {
format="$env_var"
[env_var]
format="$env_value"
@ -668,9 +632,7 @@ mod test {
format="$env_value"
[env_var.c]
format="$env_value"
}),
};
context.root_config.format = "$env_var".to_string();
});
context.env.insert("a", "a".to_string());
context.env.insert("b", "b".to_string());
context.env.insert("c", "c".to_string());
@ -683,10 +645,7 @@ mod test {
#[test]
fn custom_mixed() -> std::io::Result<()> {
let dir = tempfile::tempdir()?;
let mut context = default_context();
context.current_dir = dir.path().to_path_buf();
context.config = StarshipConfig {
config: Some(toml::toml! {
let mut context = default_context().set_config(toml::toml! {
format="${custom.c}$custom${custom.b}"
[custom.a]
when=true
@ -697,9 +656,8 @@ mod test {
[custom.c]
when=true
format="c"
}),
};
context.root_config.format = "${custom.c}$custom${custom.b}".to_string();
});
context.current_dir = dir.path().to_path_buf();
let expected = String::from("\ncab");
let actual = get_prompt(context);
@ -709,9 +667,7 @@ mod test {
#[test]
fn env_mixed() {
let mut context = default_context();
context.config = StarshipConfig {
config: Some(toml::toml! {
let mut context = default_context().set_config(toml::toml! {
format="${env_var.c}$env_var${env_var.b}"
[env_var]
format="$env_value"
@ -722,9 +678,7 @@ mod test {
format="$env_value"
[env_var.c]
format="$env_value"
}),
};
context.root_config.format = "${env_var.c}$env_var${env_var.b}".to_string();
});
context.env.insert("a", "a".to_string());
context.env.insert("b", "b".to_string());
context.env.insert("c", "c".to_string());
@ -738,10 +692,7 @@ mod test {
#[test]
fn custom_subset() -> std::io::Result<()> {
let dir = tempfile::tempdir()?;
let mut context = default_context();
context.current_dir = dir.path().to_path_buf();
context.config = StarshipConfig {
config: Some(toml::toml! {
let mut context = default_context().set_config(toml::toml! {
format="${custom.b}"
[custom.a]
when=true
@ -749,9 +700,8 @@ mod test {
[custom.b]
when=true
format="b"
}),
};
context.root_config.format = "${custom.b}".to_string();
});
context.current_dir = dir.path().to_path_buf();
let expected = String::from("\nb");
let actual = get_prompt(context);
@ -762,17 +712,13 @@ mod test {
#[test]
fn custom_missing() -> std::io::Result<()> {
let dir = tempfile::tempdir()?;
let mut context = default_context();
context.current_dir = dir.path().to_path_buf();
context.config = StarshipConfig {
config: Some(toml::toml! {
let mut context = default_context().set_config(toml::toml! {
format="${custom.b}"
[custom.a]
when=true
format="a"
}),
};
context.root_config.format = "${custom.b}".to_string();
});
context.current_dir = dir.path().to_path_buf();
let expected = String::from("\n");
let actual = get_prompt(context);

View File

@ -1,8 +1,7 @@
use crate::context::{Context, Shell, Target};
use crate::logger::StarshipLogger;
use crate::{
config::{ModuleConfig, StarshipConfig},
configs::StarshipRootConfig,
config::StarshipConfig,
utils::{create_command, CommandOutput},
};
use log::{Level, LevelFilter};
@ -89,10 +88,7 @@ impl<'a> ModuleRenderer<'a> {
/// Sets the config of the underlying context
pub fn config(mut self, config: toml::Table) -> Self {
self.context.root_config = StarshipRootConfig::load(&config);
self.context.config = StarshipConfig {
config: Some(config),
};
self.context = self.context.set_config(config);
self
}