Merge branch 'master' into conditional-style

This commit is contained in:
Filip Bachul 2023-07-21 12:12:40 +02:00
commit 0a6c7d4230
12 changed files with 451 additions and 297 deletions

View File

@ -1506,6 +1506,7 @@
"disabled": true,
"format": "[$symbol$shlvl]($style) ",
"repeat": false,
"repeat_offset": 0,
"style": "bold yellow",
"symbol": "↕️ ",
"threshold": 2
@ -5325,6 +5326,12 @@
"default": false,
"type": "boolean"
},
"repeat_offset": {
"default": 0,
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"style": {
"default": "bold yellow",
"type": "string"

View File

@ -24,7 +24,7 @@ jobs:
- name: Setup | Checkout
uses: actions/checkout@v3
- name: Install | Taplo
run: cargo install --debug --locked --version 0.8.0 taplo-cli
run: cargo install --debug --locked --version 0.8.1 taplo-cli
- name: Presets | Validate with schema
run: taplo lint --schema "file://${GITHUB_WORKSPACE}/.github/config-schema.json" docs/.vuepress/public/presets/toml/*.toml

View File

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

331
Cargo.lock generated
View File

@ -213,7 +213,7 @@ checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.22",
"syn 2.0.25",
]
[[package]]
@ -230,7 +230,7 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.22",
"syn 2.0.25",
]
[[package]]
@ -310,7 +310,7 @@ checksum = "a246e68bb43f6cd9db24bea052a53e40405417c5fb372e3d1a8a7f770a564ef5"
dependencies = [
"memchr",
"once_cell",
"regex-automata",
"regex-automata 0.1.10",
"serde",
]
@ -369,9 +369,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.3.10"
version = "4.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "384e169cc618c613d5e3ca6404dda77a8685a63e08660dcc64abaf7da7cb0c7a"
checksum = "5b0827b011f6f8ab38590295339817b0d26f344aa4932c3ced71b45b0c54b4a9"
dependencies = [
"clap_builder",
"clap_derive",
@ -380,9 +380,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.3.10"
version = "4.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef137bbe35aab78bdb468ccfba75a5f4d8321ae011d34063770780545176af2d"
checksum = "9441b403be87be858db6a23edb493e7f694761acdc3343d5a0fcaafd304cbc9e"
dependencies = [
"anstream",
"anstyle",
@ -395,23 +395,23 @@ dependencies = [
[[package]]
name = "clap_complete"
version = "4.3.1"
version = "4.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f6b5c519bab3ea61843a7923d074b04245624bb84a64a8c150f5deb014e388b"
checksum = "5fc443334c81a804575546c5a8a79b4913b50e28d69232903604cada1de817ce"
dependencies = [
"clap",
]
[[package]]
name = "clap_derive"
version = "4.3.2"
version = "4.3.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f"
checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn 2.0.22",
"syn 2.0.25",
]
[[package]]
@ -733,6 +733,15 @@ version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
[[package]]
name = "encoding_rs"
version = "0.8.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394"
dependencies = [
"cfg-if",
]
[[package]]
name = "enumflags2"
version = "0.7.7"
@ -751,7 +760,7 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.22",
"syn 2.0.25",
]
[[package]]
@ -966,9 +975,9 @@ dependencies = [
[[package]]
name = "gix"
version = "0.48.0"
version = "0.49.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1e74cea676de7f53a79f3c0365812b11f6814b81e671b8ee4abae6ca09c7881"
checksum = "3eb22530188fa1a6921b9f1aed3183357936e450ed060d65e578b46cd1c66a33"
dependencies = [
"gix-actor",
"gix-attributes",
@ -978,8 +987,9 @@ dependencies = [
"gix-date",
"gix-diff",
"gix-discover",
"gix-features",
"gix-fs",
"gix-features 0.32.0",
"gix-filter",
"gix-fs 0.4.0",
"gix-glob",
"gix-hash",
"gix-hashtable",
@ -1014,9 +1024,9 @@ dependencies = [
[[package]]
name = "gix-actor"
version = "0.23.0"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1969b77b9ee4cc1755c841987ec6f7622aaca95e952bcafb76973ae59d1b8716"
checksum = "1b2ec47eabd8edbb375e1c5cf11a2673805ae2ee02f797923fcefc3106d39f3b"
dependencies = [
"bstr",
"btoi",
@ -1028,9 +1038,9 @@ dependencies = [
[[package]]
name = "gix-attributes"
version = "0.14.1"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3772b0129dcd1fc73e985bbd08a1482d082097d2915cb1ee31ce8092b8e4434"
checksum = "f97977acd02cb3369833a428b38d74960fa90dc6f58312e54e9388f293b0d93b"
dependencies = [
"bstr",
"gix-glob",
@ -1063,22 +1073,22 @@ dependencies = [
[[package]]
name = "gix-command"
version = "0.2.6"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb49ab557a37b0abb2415bca2b10e541277dff0565deb5bd5e99fd95f93f51eb"
checksum = "378d6a93c87616a58f2c5b40ed0ca554255ba4ce3aa35cf1d597b270d06756a7"
dependencies = [
"bstr",
]
[[package]]
name = "gix-commitgraph"
version = "0.17.1"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed42baa50075d41c1a0931074ce1a97c5797c7c6fe7591d9f1f2dcd448532c26"
checksum = "c9792d974e0a54e4655b676058e0b84a76e380fa82405f296734c1f943c5c8a5"
dependencies = [
"bstr",
"gix-chunk",
"gix-features",
"gix-features 0.32.0",
"gix-hash",
"memmap2",
"thiserror",
@ -1086,13 +1096,13 @@ dependencies = [
[[package]]
name = "gix-config"
version = "0.25.1"
version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "817688c7005a716d9363e267913526adea402dabd947f4ba63842d10cc5132af"
checksum = "cfc134ddb07881832e50620f4b3dc0e5cb6734b80509d582a0c2bd31869f8f7f"
dependencies = [
"bstr",
"gix-config-value",
"gix-features",
"gix-features 0.32.0",
"gix-glob",
"gix-path",
"gix-ref",
@ -1108,9 +1118,9 @@ dependencies = [
[[package]]
name = "gix-config-value"
version = "0.12.3"
version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83960be5e99266bcf55dae5a24731bbd39f643bfb68f27e939d6b06836b5b87d"
checksum = "731170f6ada8932ddd990548f98354cc1d027509caddfdf0c8e2c0c5e94d7d1b"
dependencies = [
"bitflags 2.3.3",
"bstr",
@ -1121,9 +1131,9 @@ dependencies = [
[[package]]
name = "gix-credentials"
version = "0.16.1"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75a75565e0e6e7f80cfa4eb1b05cc448c6846ddd48dcf413a28875fbc11ee9af"
checksum = "0696fcd658b6526beff1c2716d3c94466eb2dbfaf1ecf8d961883884b687ce6d"
dependencies = [
"bstr",
"gix-command",
@ -1149,9 +1159,9 @@ dependencies = [
[[package]]
name = "gix-diff"
version = "0.32.0"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aaf5d9b9b521b284ebe53ee69eee33341835ec70edc314f36b2100ea81396121"
checksum = "accf7bfad64777ab5297bd918431f359fb39eb1d519743c2059ba5af7a513229"
dependencies = [
"gix-hash",
"gix-object",
@ -1161,9 +1171,9 @@ dependencies = [
[[package]]
name = "gix-discover"
version = "0.21.1"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "272aad20dc63dedba76615373dd8885fb5aebe4795e5b5b0aa2a24e63c82085c"
checksum = "78ddcd031c607da6acb52f6c8e3c0a50cc444ed03d444d22c6a2a772ea70a051"
dependencies = [
"bstr",
"dunce",
@ -1179,6 +1189,17 @@ name = "gix-features"
version = "0.31.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06142d8cff5d17509399b04052b64d2f9b3a311d5cff0b1a32b220f62cd0d595"
dependencies = [
"gix-hash",
"gix-trace",
"libc",
]
[[package]]
name = "gix-features"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f708dc9875d1b3e05c1cbadfd22e5b543c733c511191798587ec479115664221"
dependencies = [
"crc32fast",
"crossbeam-channel",
@ -1196,24 +1217,53 @@ dependencies = [
"walkdir",
]
[[package]]
name = "gix-filter"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8c9b3fc103a4976e4991ad949a9929fe6da5499e9f788b7f207471ec21763c7"
dependencies = [
"bstr",
"encoding_rs",
"gix-attributes",
"gix-command",
"gix-hash",
"gix-object",
"gix-packetline-blocking",
"gix-path",
"gix-quote",
"gix-trace",
"smallvec",
"thiserror",
]
[[package]]
name = "gix-fs"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb15956bc0256594c62a2399fcf6958a02a11724217eddfdc2b49b21b6292496"
dependencies = [
"gix-features",
"gix-features 0.31.1",
]
[[package]]
name = "gix-fs"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86ca81d3888c5b0ac908cbe6ee975451b117b475324987f8aecf42bc5d9e4279"
dependencies = [
"gix-features 0.32.0",
]
[[package]]
name = "gix-glob"
version = "0.9.1"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c18bdff83143d61e7d60da6183b87542a870d026b2a2d0b30170b8e9c0cd321a"
checksum = "b1ddc03b04f2ef410e156c90d05080651e06f617a2d083030a5daff5e6fe0b88"
dependencies = [
"bitflags 2.3.3",
"bstr",
"gix-features",
"gix-features 0.32.0",
"gix-path",
]
@ -1240,9 +1290,9 @@ dependencies = [
[[package]]
name = "gix-ignore"
version = "0.4.1"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca801f2d0535210f77b33e2c067d565aedecacc82f1b3dbce26da1388ebc4634"
checksum = "65ffd8e8860fd2eff53038101828fe8d19e5aad9dc869d9f1fbea825cf2830cf"
dependencies = [
"bstr",
"gix-glob",
@ -1252,16 +1302,16 @@ dependencies = [
[[package]]
name = "gix-index"
version = "0.20.0"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68099abdf6ee50ae3c897e8b05de96871cbe54d52a37cdf559101f911b883562"
checksum = "e447ecb5c8365cdd1d8fe55d6cb047279657ef1747c4347755a4b64ff3b2f0d6"
dependencies = [
"bitflags 2.3.3",
"bstr",
"btoi",
"filetime",
"gix-bitmap",
"gix-features",
"gix-features 0.32.0",
"gix-hash",
"gix-lock",
"gix-object",
@ -1285,9 +1335,9 @@ dependencies = [
[[package]]
name = "gix-mailmap"
version = "0.15.0"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1787e3c37fc43b1f7c0e3be6196c6837b3ba5f869190dfeaa444b816f0a7f34b"
checksum = "fe5a913fd8f56ea21cbd3b8bf813e0b410771682a065a14a4e9dede1012cd532"
dependencies = [
"bstr",
"gix-actor",
@ -1297,9 +1347,9 @@ dependencies = [
[[package]]
name = "gix-negotiate"
version = "0.4.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e7bce64d4452dd609f44d04b14b29da2e0ad2c45fcdf4ce1472a5f5f8ec21c2"
checksum = "945302d90a0519a31acc42e7584d1e08156ef59b179e3bbf1fd9c0e40d819e64"
dependencies = [
"bitflags 2.3.3",
"gix-commitgraph",
@ -1313,15 +1363,15 @@ dependencies = [
[[package]]
name = "gix-object"
version = "0.32.0"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a953f3d7ffad16734aa3ab1d05807972c80e339d1bd9dde03e0198716b99e2a6"
checksum = "bf32d43ccbeb9f2f54a74ee0a4b6a37143b0ba18a22288f4b790869cce232c46"
dependencies = [
"bstr",
"btoi",
"gix-actor",
"gix-date",
"gix-features",
"gix-features 0.32.0",
"gix-hash",
"gix-validate",
"hex",
@ -1333,13 +1383,13 @@ dependencies = [
[[package]]
name = "gix-odb"
version = "0.49.1"
version = "0.50.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6418cff00ecc2713b58c8e04bff30dda808fbba1a080e7248b299d069894a01"
checksum = "892c87273faa345ea12438c4ce2b89be15ae4abfda383035b8a3950965327d97"
dependencies = [
"arc-swap",
"gix-date",
"gix-features",
"gix-features 0.32.0",
"gix-hash",
"gix-object",
"gix-pack",
@ -1352,14 +1402,14 @@ dependencies = [
[[package]]
name = "gix-pack"
version = "0.39.1"
version = "0.40.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "414935138d90043ea5898de7a93f02c2558e52652492719470e203ef26a8fd0a"
checksum = "3163c2bdbb1ec45a717b5bbab69d715b2a5711c19f91f9a3045c6f805cc59c83"
dependencies = [
"clru",
"gix-chunk",
"gix-diff",
"gix-features",
"gix-features 0.32.0",
"gix-hash",
"gix-hashtable",
"gix-object",
@ -1373,6 +1423,17 @@ dependencies = [
"uluru",
]
[[package]]
name = "gix-packetline-blocking"
version = "0.16.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aef45b51fba629b588c3c50b57c815edebd5dddf7daa33736c33f160f9a64f34"
dependencies = [
"bstr",
"hex",
"thiserror",
]
[[package]]
name = "gix-path"
version = "0.8.3"
@ -1388,14 +1449,14 @@ dependencies = [
[[package]]
name = "gix-prompt"
version = "0.5.2"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8dfd363fd89a40c1e7bff9c9c1b136cd2002480f724b0c627c1bc771cd5480ec"
checksum = "abe84674ac2473f98dea1832f727ddb16acbff3262dbf226f0a9be188b9a922b"
dependencies = [
"gix-command",
"gix-config-value",
"parking_lot",
"rustix 0.37.21",
"rustix 0.38.4",
"thiserror",
]
@ -1412,14 +1473,14 @@ dependencies = [
[[package]]
name = "gix-ref"
version = "0.32.1"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39453f4e5f23cddc2e6e4cca2ba20adfdbec29379e3ca829714dfe98ae068ccd"
checksum = "e368f5368279e97148a6214ec534bfebd1f29a0fe344947d92f488397bb27a08"
dependencies = [
"gix-actor",
"gix-date",
"gix-features",
"gix-fs",
"gix-features 0.32.0",
"gix-fs 0.4.0",
"gix-hash",
"gix-lock",
"gix-object",
@ -1433,9 +1494,9 @@ dependencies = [
[[package]]
name = "gix-refspec"
version = "0.13.0"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8e76ff1f82fba295a121e31ab02f69642994e532c45c0c899aa393f4b740302"
checksum = "df521f8fc9cbd82d9abb01b8047b653de1e58c9b4b919d63218d7da2a9cd91d7"
dependencies = [
"bstr",
"gix-hash",
@ -1447,9 +1508,9 @@ dependencies = [
[[package]]
name = "gix-revision"
version = "0.17.0"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "237428a7d3978e8572964e1e45d984027c2acc94df47e594baa6c4b0da7c9922"
checksum = "1503e94badcbb9d8dc6ea3063522798913ead8f37f564f2cc335eff572208178"
dependencies = [
"bstr",
"gix-date",
@ -1462,9 +1523,9 @@ dependencies = [
[[package]]
name = "gix-revwalk"
version = "0.3.0"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "028d50fcaf8326a8f79a359490d9ca9fb4e2b51ac9ac86503560d0bcc888d2eb"
checksum = "3f43049c861d0de876d9022f61fddca4081f17c51d4dc5f7541621a076cb3218"
dependencies = [
"gix-commitgraph",
"gix-date",
@ -1493,7 +1554,7 @@ version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fac8310c17406ea619af72f42ee46dac795110f68f41b4f4fa231b69889c6a2"
dependencies = [
"gix-fs",
"gix-fs 0.3.0",
"libc",
"once_cell",
"parking_lot",
@ -1510,9 +1571,9 @@ checksum = "103eac621617be3ebe0605c9065ca51a223279a23218aaf67d10daa6e452f663"
[[package]]
name = "gix-traverse"
version = "0.29.0"
version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3cdfd54598db4fae57d5ae6f52958422b2d13382d2745796bfe5c8015ffa86e"
checksum = "be19057a9ddef95af02d32b8b8d953cf974c4d378918e5e97d7345b843e0c271"
dependencies = [
"gix-commitgraph",
"gix-date",
@ -1526,12 +1587,12 @@ dependencies = [
[[package]]
name = "gix-url"
version = "0.20.1"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "beaede6dbc83f408b19adfd95bb52f1dbf01fb8862c3faf6c6243e2e67fcdfa1"
checksum = "092d3f8f4040ee1b82830224e9002fff69248348af27dfdbcc8536db80283945"
dependencies = [
"bstr",
"gix-features",
"gix-features 0.32.0",
"gix-path",
"home",
"thiserror",
@ -1559,15 +1620,16 @@ dependencies = [
[[package]]
name = "gix-worktree"
version = "0.21.1"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1363b9aa66b9e14412ac04e1f759827203f491729d92172535a8ce6cde02efa"
checksum = "07b773e8e249c13fce5757b15e2620078adfec9dcfbfc7d243fbabf5bb49f121"
dependencies = [
"bstr",
"filetime",
"gix-attributes",
"gix-features",
"gix-fs",
"gix-features 0.32.0",
"gix-filter",
"gix-fs 0.4.0",
"gix-glob",
"gix-hash",
"gix-ignore",
@ -1745,7 +1807,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24fddda5af7e54bf7da53067d6e802dbcc381d0a8eef629df528e3ebf68755cb"
dependencies = [
"hermit-abi",
"rustix 0.38.1",
"rustix 0.38.4",
"windows-sys",
]
@ -2244,9 +2306,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
[[package]]
name = "pest"
version = "2.7.0"
version = "2.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f73935e4d55e2abf7f130186537b19e7a4abc886a0252380b59248af473a3fc9"
checksum = "0d2d1d55045829d65aad9d389139882ad623b33b904e7c9f1b10c5b8927298e5"
dependencies = [
"thiserror",
"ucd-trie",
@ -2254,9 +2316,9 @@ dependencies = [
[[package]]
name = "pest_derive"
version = "2.7.0"
version = "2.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aef623c9bbfa0eedf5a0efba11a5ee83209c326653ca31ff019bec3a95bfff2b"
checksum = "5f94bca7e7a599d89dea5dfa309e217e7906c3c007fb9c3299c40b10d6a315d3"
dependencies = [
"pest",
"pest_generator",
@ -2264,22 +2326,22 @@ dependencies = [
[[package]]
name = "pest_generator"
version = "2.7.0"
version = "2.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3e8cba4ec22bada7fc55ffe51e2deb6a0e0db2d0b7ab0b103acc80d2510c190"
checksum = "99d490fe7e8556575ff6911e45567ab95e71617f43781e5c05490dc8d75c965c"
dependencies = [
"pest",
"pest_meta",
"proc-macro2",
"quote",
"syn 2.0.22",
"syn 2.0.25",
]
[[package]]
name = "pest_meta"
version = "2.7.0"
version = "2.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a01f71cb40bd8bb94232df14b946909e14660e33fc05db3e50ae2a82d7ea0ca0"
checksum = "2674c66ebb4b4d9036012091b537aae5878970d6999f81a265034d85b136b341"
dependencies = [
"once_cell",
"pest",
@ -2547,12 +2609,13 @@ dependencies = [
[[package]]
name = "regex"
version = "1.8.4"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f"
checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata 0.3.1",
"regex-syntax",
]
@ -2563,10 +2626,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
[[package]]
name = "regex-syntax"
version = "0.7.2"
name = "regex-automata"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78"
checksum = "e9aaecc05d5c4b5f7da074b9a0d1a0867e71fd36e7fc0482d8bcfe8e8fc56290"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ab07dc67230e4a4718e70fd5c20055a4334b121f1f9db8fe63ef39ce9b8c846"
[[package]]
name = "rust-ini"
@ -2594,9 +2668,9 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.38.1"
version = "0.38.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbc6396159432b5c8490d4e301d8c705f61860b8b6c863bf79942ce5401968f3"
checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5"
dependencies = [
"bitflags 2.3.3",
"errno 0.3.1",
@ -2662,9 +2736,9 @@ dependencies = [
[[package]]
name = "semver"
version = "1.0.17"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918"
[[package]]
name = "semver-parser"
@ -2677,22 +2751,22 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.166"
version = "1.0.173"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d01b7404f9d441d3ad40e6a636a7782c377d2abdbe4fa2440e2edcc2f4f10db8"
checksum = "e91f70896d6720bc714a4a57d22fc91f1db634680e65c8efe13323f1fa38d53f"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.166"
version = "1.0.173"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5dd83d6dde2b6b2d466e14d9d1acce8816dedee94f735eac6395808b3483c6d6"
checksum = "a6250dde8342e0232232be9ca3db7aa40aceb5a3e5dd9bddbc00d99a007cde49"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.22",
"syn 2.0.25",
]
[[package]]
@ -2708,9 +2782,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.99"
version = "1.0.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3"
checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b"
dependencies = [
"itoa",
"ryu",
@ -2725,7 +2799,7 @@ checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.22",
"syn 2.0.25",
]
[[package]]
@ -2887,7 +2961,7 @@ dependencies = [
"dunce",
"gethostname",
"gix",
"gix-features",
"gix-features 0.32.0",
"guess_host_triple",
"home",
"indexmap 1.9.3",
@ -2909,7 +2983,7 @@ dependencies = [
"regex",
"rust-ini",
"schemars",
"semver 1.0.17",
"semver 1.0.18",
"serde",
"serde_json",
"sha1",
@ -2920,7 +2994,7 @@ dependencies = [
"systemstat",
"tempfile",
"terminal_size",
"toml 0.7.5",
"toml 0.7.6",
"toml_edit",
"unicode-segmentation",
"unicode-width",
@ -2974,9 +3048,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.22"
version = "2.0.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2efbeae7acf4eabd6bcdcbd11c92f45231ddda7539edc7806bd1a04a03b24616"
checksum = "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2"
dependencies = [
"proc-macro2",
"quote",
@ -3009,15 +3083,14 @@ dependencies = [
[[package]]
name = "tempfile"
version = "3.6.0"
version = "3.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6"
checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998"
dependencies = [
"autocfg",
"cfg-if",
"fastrand 1.9.0",
"fastrand 2.0.0",
"redox_syscall 0.3.5",
"rustix 0.37.21",
"rustix 0.38.4",
"windows-sys",
]
@ -3108,7 +3181,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.22",
"syn 2.0.25",
]
[[package]]
@ -3175,9 +3248,9 @@ dependencies = [
[[package]]
name = "toml"
version = "0.7.5"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ebafdf5ad1220cb59e7d17cf4d2c72015297b75b19a10472f99b89225089240"
checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542"
dependencies = [
"indexmap 2.0.0",
"serde",
@ -3197,9 +3270,9 @@ dependencies = [
[[package]]
name = "toml_edit"
version = "0.19.11"
version = "0.19.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "266f016b7f039eec8a1a80dfe6156b633d208b9fccca5e4db1d6775b0c4e34a7"
checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a"
dependencies = [
"indexmap 2.0.0",
"serde",
@ -3228,7 +3301,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.22",
"syn 2.0.25",
]
[[package]]
@ -3432,7 +3505,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.22",
"syn 2.0.25",
"wasm-bindgen-shared",
]
@ -3454,7 +3527,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.22",
"syn 2.0.25",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@ -3627,9 +3700,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
[[package]]
name = "winnow"
version = "0.4.7"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448"
checksum = "81fac9742fd1ad1bd9643b991319f72dd031016d44b77039a26977eb667141e7"
dependencies = [
"memchr",
]

View File

@ -43,14 +43,14 @@ 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.10", features = ["derive", "cargo", "unicode"] }
clap_complete = "4.3.1"
clap = { version = "4.3.17", features = ["derive", "cargo", "unicode"] }
clap_complete = "4.3.2"
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.48.0", default-features = false, features = ["max-performance-safe"] }
gix-features = { version = "0.31.1", optional = true }
gix = { version = "0.49.1", default-features = false, features = ["max-performance-safe"] }
gix-features = { version = "0.32.0", optional = true }
indexmap = { version = "1.9.3", features = ["serde"] }
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
@ -62,16 +62,16 @@ open = "5.0.0"
# update os module config and tests when upgrading os_info
os_info = "3.7.0"
path-slash = "0.2.1"
pest = "2.7.0"
pest_derive = "2.7.0"
pest = "2.7.1"
pest_derive = "2.7.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"] }
regex = { version = "1.9.1", default-features = false, features = ["perf", "std", "unicode-perl"] }
rust-ini = "0.19.0"
semver = "1.0.17"
serde = { version = "1.0.166", features = ["derive"] }
serde_json = "1.0.99"
semver = "1.0.18"
serde = { version = "1.0.173", features = ["derive"] }
serde_json = "1.0.103"
sha1 = "0.10.5"
shadow-rs = { version = "0.23.0", default-features = false }
# battery is optional (on by default) because the crate doesn't currently build for Termux
@ -80,8 +80,8 @@ starship-battery = { version = "0.8.1", optional = true }
strsim = "0.10.0"
systemstat = "=0.2.3"
terminal_size = "0.2.6"
toml = { version = "0.7.5", features = ["preserve_order"] }
toml_edit = "0.19.11"
toml = { version = "0.7.6", features = ["preserve_order"] }
toml_edit = "0.19.14"
unicode-segmentation = "1.10.1"
unicode-width = "0.1.10"
urlencoding = "2.1.2"
@ -125,7 +125,7 @@ winres = "0.1.12"
[dev-dependencies]
mockall = "0.11"
tempfile = "3.6.0"
tempfile = "3.7.0"
[profile.release]
codegen-units = 1

View File

@ -223,7 +223,6 @@ Alternatively, install Starship using any of the following package managers:
| **_Any_** | **[crates.io]** | `cargo install starship --locked` |
| _Any_ | [conda-forge] | `conda install -c conda-forge starship` |
| _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 Extra] | `pacman -S starship` |
| CentOS 7+ | [Copr] | `dnf copr enable atim/starship` <br /> `dnf install starship` |
@ -458,7 +457,6 @@ This project is [ISC](https://github.com/starship/starship/blob/master/LICENSE)
[nixpkgs]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/starship/default.nix
[pkgsrc]: https://pkgsrc.se/shells/starship
[scoop]: https://github.com/ScoopInstaller/Main/blob/master/bucket/starship.json
[snapcraft]: https://snapcraft.io/starship
[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

View File

@ -3772,14 +3772,15 @@ set to a number and meets or exceeds the specified threshold.
### Options
| Option | Default | Description |
| ----------- | ---------------------------- | ------------------------------------------------------------- |
| `threshold` | `2` | Display threshold. |
| `format` | `'[$symbol$shlvl]($style) '` | The format for the module. |
| `symbol` | `'↕️ '` | The symbol used to represent the `SHLVL`. |
| `repeat` | `false` | Causes `symbol` to be repeated by the current `SHLVL` amount. |
| `style` | `'bold yellow'` | The style for the module. |
| `disabled` | `true` | Disables the `shlvl` module. |
| Option | Default | Description |
| --------------- | ---------------------------- | ------------------------------------------------------------------- |
| `threshold` | `2` | Display threshold. |
| `format` | `'[$symbol$shlvl]($style) '` | The format for the module. |
| `symbol` | `'↕️ '` | The symbol used to represent the `SHLVL`. |
| `repeat` | `false` | Causes `symbol` to be repeated by the current `SHLVL` amount. |
| `repeat_offset` | `0` | Decrements number of times `symbol` is repeated by the offset value |
| `style` | `'bold yellow'` | The style for the module. |
| `disabled` | `true` | Disables the `shlvl` module. |
### Variables
@ -3802,6 +3803,22 @@ format = '$shlvl level(s) down'
threshold = 3
```
Using `repeat` and `repeat_offset` along with `character` module, one can get
prompt like `` where last character is colored appropriately for return
status code and preceeding characters are provided by `shlvl`.
```toml
# ~/.config/starship.toml
[shlvl]
disabled = false
format = '[$symbol$shlvl]($style)'
repeat = true
symbol = ''
repeat_offset = 1
threshold = 0
```
## Singularity
The `singularity` module shows the current [Singularity](https://sylabs.io/singularity/) image, if inside a container

View File

@ -1,91 +0,0 @@
name: starship
base: core20
adopt-info: starship
summary: The minimal, blazing-fast, and infinitely customizable prompt for any shell!
description: |
Starship is the minimal, blazing fast, and extremely customizable prompt
for any shell! The prompt shows information you need while you're working,
while staying sleek and out of the way.
## Prerequisites
A Powerline font installed and enabled in your terminal (for example, try Fira Code).
* https://github.com/powerline/fonts
* https://github.com/tonsky/FiraCode
## Getting Started
Add the init script to your shell's config file:
### Bash
Add the following to the end of ~/.bashrc:
`eval "$(starship init bash)"`
### Fish
Add the following to the end of ~/.config/fish/config.fish:
# ~/.config/fish/config.fish
starship init fish | source
### Zsh
Add the following to the end of ~/.zshrc:
eval "$(starship init zsh)"
### Powershell
Add the following to the end of ~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 (or ~/.config/powershell/Microsoft.PowerShell_profile.ps1 on -Nix):
`Invoke-Expression (&starship init powershell)`
### Xonsh
Add the following to the end of ~/.xonshrc:
execx($(starship init xonsh))
grade: stable
confinement: strict
parts:
starship:
plugin: rust
source: https://github.com/starship/starship.git
#source-tag: v$SNAPCRAFT_PROJECT_VERSION
build-packages:
- cmake
- pkg-config
override-build: |
last_committed_tag="$(git describe --tags --abbrev=0)"
last_committed_tag_ver="$(echo ${last_committed_tag} | sed 's/v//')"
last_released_tag="$(snap info $SNAPCRAFT_PROJECT_NAME | awk '$1 == "beta:" { print $2 }')"
# If the latest tag from the upstream project has not been released to
# beta, build that tag instead of master.
if [ "${last_committed_tag_ver}" != "${last_released_tag}" ]; then
git fetch
git checkout "${last_committed_tag}"
cd ../src
git checkout "${last_committed_tag}"
fi
snapcraftctl build
snapcraftctl set-version $(git -C ../src describe --tags | sed 's/v//')
apps:
starship:
command: bin/starship
plugs:
- home
- removable-media
- personal-files
architectures:
- build-on: amd64
- build-on: arm64
- build-on: armhf
- build-on: i386
- build-on: ppc64el
- build-on: s390x

View File

@ -12,6 +12,7 @@ pub struct ShLvlConfig<'a> {
pub format: &'a str,
pub symbol: &'a str,
pub repeat: bool,
pub repeat_offset: u64,
pub style: &'a str,
pub disabled: bool,
}
@ -23,6 +24,7 @@ impl<'a> Default for ShLvlConfig<'a> {
format: "[$symbol$shlvl]($style) ",
symbol: "↕️ ", // extra space for emoji
repeat: false,
repeat_offset: 0,
style: "bold yellow",
disabled: true,
}

View File

@ -244,18 +244,28 @@ fn get_repo_status(context: &Context, config: &GitStatusConfig) -> Option<RepoSt
}
fn get_stashed_count(context: &Context) -> Option<usize> {
let stash_output = context.exec_cmd(
"git",
&[
OsStr::new("-C"),
context.current_dir.as_os_str(),
OsStr::new("--no-optional-locks"),
OsStr::new("stash"),
OsStr::new("list"),
],
)?;
let repo = context.get_repo().ok()?.open();
let reference = match repo.try_find_reference("refs/stash") {
Ok(Some(reference)) => reference,
// No stash reference found
Ok(None) => return Some(0),
Err(err) => {
log::warn!("Error finding stash reference: {err}");
return None;
}
};
Some(stash_output.stdout.trim().lines().count())
match reference.log_iter().all() {
Ok(Some(log)) => Some(log.count()),
Ok(None) => {
log::debug!("No reflog found for stash");
Some(0)
}
Err(err) => {
log::warn!("Error getting stash log: {err}");
None
}
}
}
#[derive(Default, Debug, Copy, Clone)]
@ -744,9 +754,38 @@ mod tests {
.output()?;
let actual = ModuleRenderer::new("git_status")
.config(toml::toml! {
[git_status]
format = "$stashed"
})
.path(repo_dir.path())
.collect();
let expected = format_output("$");
let expected = Some(String::from("$"));
assert_eq!(expected, actual);
repo_dir.close()
}
#[test]
fn shows_no_stashed_after_undo() -> io::Result<()> {
let repo_dir = fixture_repo(FixtureProvider::Git)?;
create_stash(repo_dir.path())?;
undo_stash(repo_dir.path())?;
create_command("git")?
.args(["reset", "--hard", "HEAD"])
.current_dir(repo_dir.path())
.output()?;
let actual = ModuleRenderer::new("git_status")
.config(toml::toml! {
[git_status]
format = "$stashed"
})
.path(repo_dir.path())
.collect();
let expected = None;
assert_eq!(expected, actual);
repo_dir.close()
@ -756,6 +795,9 @@ mod tests {
fn shows_stashed_with_count() -> io::Result<()> {
let repo_dir = fixture_repo(FixtureProvider::Git)?;
create_stash(repo_dir.path())?;
undo_stash(repo_dir.path())?;
create_stash(repo_dir.path())?;
create_stash(repo_dir.path())?;
create_command("git")?
@ -770,7 +812,7 @@ mod tests {
})
.path(repo_dir.path())
.collect();
let expected = format_output("$1");
let expected = format_output("$2");
assert_eq!(expected, actual);
repo_dir.close()
@ -1177,7 +1219,8 @@ mod tests {
}
fn create_stash(repo_dir: &Path) -> io::Result<()> {
File::create(repo_dir.join("readme.md"))?.sync_all()?;
let (file, _path) = tempfile::NamedTempFile::new_in(repo_dir)?.keep()?;
file.sync_all()?;
create_command("git")?
.args(["stash", "--all"])
@ -1187,6 +1230,15 @@ mod tests {
Ok(())
}
fn undo_stash(repo_dir: &Path) -> io::Result<()> {
create_command("git")?
.args(["stash", "pop"])
.current_dir(repo_dir)
.output()?;
Ok(())
}
fn create_untracked(repo_dir: &Path) -> io::Result<()> {
File::create(repo_dir.join("license"))?.sync_all()?;

View File

@ -22,11 +22,20 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let shlvl_str = &shlvl.to_string();
let repeat_count = if config.repeat {
let mut repeat_count: usize = if config.repeat {
shlvl.try_into().unwrap_or(1)
} else {
1
};
if config.repeat_offset > 0 {
repeat_count =
repeat_count.saturating_sub(config.repeat_offset.try_into().unwrap_or(usize::MAX));
if repeat_count == 0 {
return None;
}
}
let symbol = if repeat_count != 1 {
Cow::Owned(config.symbol.repeat(repeat_count))
} else {
@ -219,4 +228,33 @@ mod tests {
assert_eq!(expected, actual);
}
#[test]
fn repeat_offset() {
fn get_actual(shlvl: usize, repeat_offset: usize, threshold: usize) -> Option<String> {
ModuleRenderer::new("shlvl")
.config(toml::toml! {
[shlvl]
format = "[$symbol]($style)"
symbol = "~"
repeat = true
repeat_offset = repeat_offset
disabled = false
threshold = threshold
})
.env(SHLVL_ENV_VAR, format!("{}", shlvl))
.collect()
}
assert_eq!(
get_actual(2, 0, 0),
Some(format!("{}", style().paint("~~")))
);
assert_eq!(get_actual(2, 1, 0), Some(format!("{}", style().paint("~"))));
assert_eq!(get_actual(2, 2, 0), None); // offset same as shlvl; hide
assert_eq!(get_actual(2, 3, 0), None); // offset larger than shlvl; hide
assert_eq!(get_actual(2, 1, 3), None); // high threshold; hide
// threshold not high enough; hide
assert_eq!(get_actual(2, 1, 2), Some(format!("{}", style().paint("~"))));
}
}

View File

@ -12,7 +12,6 @@ use unicode_width::UnicodeWidthChar;
use crate::configs::PROMPT_ORDER;
use crate::context::{Context, Properties, Shell, Target};
use crate::formatter::string_formatter::StringFormatterError;
use crate::formatter::{StringFormatter, VariableHolder};
use crate::module::Module;
use crate::module::ALL_MODULES;
@ -405,43 +404,65 @@ fn all_modules_uniq(module_list: &BTreeSet<String>) -> Vec<String> {
/// and the list of all modules used in a format string
fn load_formatter_and_modules<'a>(context: &'a Context) -> (StringFormatter<'a>, BTreeSet<String>) {
let config = &context.root_config;
let (formatter, config_param) = match &context.target {
Target::Main => (StringFormatter::new(&config.format), "format".to_string()),
Target::Right => (
StringFormatter::new(&config.right_format),
"right_format".to_string(),
),
Target::Continuation => (
StringFormatter::new(&config.continuation_prompt),
"continuation_prompt".to_string(),
),
Target::Profile(name) => (
match config.profiles.get(name) {
Some(format) => StringFormatter::new(format),
_ => Err(StringFormatterError::Custom("Invalid Profile".to_string())),
},
format!("profile: {}", &name),
),
if context.target == Target::Continuation {
let cf = &config.continuation_prompt;
let formatter = StringFormatter::new(cf);
return match formatter {
Ok(f) => {
let modules = f.get_variables().into_iter().collect();
(f, modules)
}
Err(e) => {
log::error!("Error parsing continuation prompt: {e}");
(StringFormatter::raw(">"), BTreeSet::new())
}
};
}
let (left_format_str, right_format_str): (&str, &str) = match context.target {
Target::Main | Target::Right => (&config.format, &config.right_format),
Target::Profile(ref name) => {
if let Some(lf) = config.profiles.get(name) {
(lf, "")
} else {
log::error!("Profile {name:?} not found");
return (StringFormatter::raw(">"), BTreeSet::new());
}
}
Target::Continuation => unreachable!("Continuation prompt should have been handled above"),
};
let rformatter = StringFormatter::new(&config.right_format);
let lf = StringFormatter::new(left_format_str);
let rf = StringFormatter::new(right_format_str);
if formatter.is_err() {
log::error!("Error parsing `{}`", config_param);
}
if rformatter.is_err() {
log::error!("Error parsing `right_format`")
if let Err(ref e) = lf {
let name = if let Target::Profile(ref profile_name) = context.target {
format!("profile.{profile_name}")
} else {
"format".to_string()
};
log::error!("Error parsing {name:?}: {e}");
};
if let Err(ref e) = rf {
log::error!("Error parsing right_format: {e}");
}
match (formatter, rformatter) {
(Ok(lf), Ok(rf)) => {
let mut modules: BTreeSet<String> = BTreeSet::new();
if context.target != Target::Continuation {
modules.extend(lf.get_variables());
modules.extend(rf.get_variables());
}
(lf, modules)
}
let modules = [&lf, &rf]
.into_iter()
.flatten()
.flat_map(|f| f.get_variables())
.collect();
let main_formatter = match context.target {
Target::Main | Target::Profile(_) => lf,
Target::Right => rf,
Target::Continuation => unreachable!("Continuation prompt should have been handled above"),
};
match main_formatter {
Ok(f) => (f, modules),
_ => (StringFormatter::raw(">"), BTreeSet::new()),
}
}
@ -526,13 +547,50 @@ mod test {
}
#[test]
fn custom_prompt() {
fn prompt_with_all() -> io::Result<()> {
let mut context = default_context().set_config(toml::toml! {
add_newline = false
[profiles]
test="0_0$character"
right_format= "$directory$line_break"
format="$all"
[character]
format=">>"
format=">"
});
let dir = tempfile::tempdir().unwrap();
context.current_dir = dir.path().to_path_buf();
let expected = String::from(">");
let actual = get_prompt(context);
assert_eq!(expected, actual);
dir.close()
}
#[test]
fn rprompt_with_all() -> io::Result<()> {
let mut context = default_context().set_config(toml::toml! {
format= "$directory$line_break"
right_format="$all"
[character]
format=">"
});
let dir = tempfile::tempdir().unwrap();
context.current_dir = dir.path().to_path_buf();
context.target = Target::Right;
let expected = String::from(">");
let actual = get_prompt(context);
assert_eq!(expected, actual);
dir.close()
}
#[test]
fn custom_prompt() {
let mut context = default_context().set_config(toml::toml! {
add_newline = false
[profiles]
test="0_0$character"
[character]
format=">>"
});
context.target = Target::Profile("test".to_string());