From b33538bfb18ca52d8810b74bdc1de63e155f2ea0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 8 Jun 2023 15:50:30 +0000 Subject: [PATCH 01/18] build(deps): update crate-ci/typos action to v1.15.0 --- .github/workflows/spell-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml index ff5c27f6a..f0c678bb4 100644 --- a/.github/workflows/spell-check.yml +++ b/.github/workflows/spell-check.yml @@ -7,4 +7,4 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: crate-ci/typos@v1.14.12 + - uses: crate-ci/typos@v1.15.0 From 470aeb09a72936a66937d68f96165a977b5c213d Mon Sep 17 00:00:00 2001 From: Antoine Stevan <44101798+amtoine@users.noreply.github.com> Date: Mon, 12 Jun 2023 11:02:46 +0200 Subject: [PATCH 02/18] feat: update the nushell init file and make it valid module and overlay (#5188) * break long commands into multiple lines for readability * fix the format of closures We generally write `{|| ...}` instead of `{ || ...}`. * remove the `$"--opt=(val)"` structure when possible `starship` does not require to use `--opt=val` and so we do not need to do that with Nushell :) the only place where this is required is with `--status` because `$env.LAST_EXIT_CODE` can be negative and `starship` does not appear to *like* values of the form `-2`... so i left this line as it was. on the other hand, `$env.CMD_DURATION_MS` and `(term size).columns` should be fine :relieved: * simplify the `config` mutation with new `?` syntax This is a new very handy feature of Nushell which gives a much simpler command combined with `default` and `merge`. * put all `let-env`s inside an `export-env` with `load-env` This commit has two reasons of existing: - i think it makes it a bit easier to read with less `let-env`s - it transforms the *script* into both a valid module and a valid overlay * bump the version to `0.78` in to docs * add a note about the init file being also a module to all docs * tweak the documentation * update the Nushell part of the install script * format the vuepress config file as previous commit 117580136d3da5e00a4ccb7ada508c8510a2e50e was not successful, let's try to make the CI happy manually :relieved: * remove code quotes in the `config_cmd` of Nushell * format the style in the Nushell `warning` section --- README.md | 4 +-- docs/.vuepress/config.ts | 6 ++--- docs/README.md | 5 ++-- install/install.sh | 11 ++++---- src/init/starship.nu | 58 ++++++++++++++++++++++++---------------- 5 files changed, 49 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index b12c1a277..96fa1e000 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docs/.vuepress/config.ts b/docs/.vuepress/config.ts index 393a2bfad..38d18333a 100644 --- a/docs/.vuepress/config.ts +++ b/docs/.vuepress/config.ts @@ -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');", ], diff --git a/docs/README.md b/docs/README.md index 0665a4311..747b38fb8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -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`: diff --git a/install/install.sh b/install/install.sh index 6c1f9a2a8..494a9cbf5 100755 --- a/install/install.sh +++ b/install/install.sh @@ -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" \ diff --git a/src/init/starship.nu b/src/init/starship.nu index fd8729d29..0601e1806 100644 --- a/src/init/starship.nu +++ b/src/init/starship.nu @@ -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 + ) + } +}} From 9f5b12d5195686a3103a6249c44de9d4c1512a06 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 11:04:05 +0200 Subject: [PATCH 03/18] build(deps): update rust crate serde to 1.0.164 (#5231) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 354d5c75c..0065e8bbd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2670,18 +2670,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", diff --git a/Cargo.toml b/Cargo.toml index ddf551715..580898183 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,7 +70,7 @@ 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 = { version = "1.0.164", features = ["derive"] } serde_json = "1.0.96" sha1 = "0.10.5" shadow-rs = { version = "0.22.0", default-features = false } From ed68fd6e3d243da4a4674dfe8f1a104c8d564eb8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 11:04:43 +0200 Subject: [PATCH 04/18] build(deps): update rust crate starship-battery to 0.8.1 (#5232) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0065e8bbd..97621951f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2927,9 +2927,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", diff --git a/Cargo.toml b/Cargo.toml index 580898183..aafb4cea0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -76,7 +76,7 @@ sha1 = "0.10.5" shadow-rs = { version = "0.22.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" From 318050976b58f032a17ff4d122d21cb63faf8e3b Mon Sep 17 00:00:00 2001 From: Nemo157 Date: Mon, 12 Jun 2023 11:05:44 +0200 Subject: [PATCH 05/18] feat(pwsh): Support vi command mode indicator (#5049) Support vi command mode in powershell --- src/init/starship.ps1 | 10 ++++++++++ src/modules/character.rs | 38 +++++++++++++++++++++++++++++++++++--- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/src/init/starship.ps1 b/src/init/starship.ps1 index 4422a1ed2..f31d223db 100755 --- a/src/init/starship.ps1 +++ b/src/init/starship.ps1 @@ -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" diff --git a/src/modules/character.rs b/src/modules/character.rs index 7fd19c8ec..c897b4260 100644 --- a/src/modules/character.rs +++ b/src/modules/character.rs @@ -35,9 +35,9 @@ pub fn module<'a>(context: &'a Context) -> Option> { // 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, @@ -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); + } } From 24583e8bcd0e4632b6116017303e220f6f593207 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 11:36:21 +0200 Subject: [PATCH 06/18] build(deps): update rust crate clap to 4.3.3 (#5235) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 97621951f..a016370c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -351,9 +351,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.2" +version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "401a4694d2bf92537b6867d94de48c4842089645fdcdf6c71865b175d836e9c2" +checksum = "ca8f255e4b8027970e78db75e78831229c9815fdbfa67eb1a1b777a62e24b4a0" dependencies = [ "clap_builder", "clap_derive", @@ -362,9 +362,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.1" +version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72394f3339a76daf211e57d4bcb374410f3965dcc606dd0e03738c7888766980" +checksum = "acd4f3c17c83b0ba34ffbc4f8bbd74f079413f747f84a6f89292f138057e36ab" dependencies = [ "anstream", "anstyle", diff --git a/Cargo.toml b/Cargo.toml index aafb4cea0..220087d5e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,7 @@ 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.3", features = ["derive", "cargo", "unicode"] } clap_complete = "4.3.1" dirs-next = "2.0.0" dunce = "1.0.4" From 515f1862b8a5aecbd0431af4047fecfad44a7928 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 09:03:46 +0000 Subject: [PATCH 07/18] build(deps): update rust crate gix to 0.46.0 --- Cargo.lock | 58 ++++++++++++++++++++++++++++++++++-------------------- Cargo.toml | 2 +- 2 files changed, 38 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a016370c7..62dfbeb49 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", diff --git a/Cargo.toml b/Cargo.toml index 220087d5e..90f56828d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,7 +49,7 @@ 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"] } From ca74c4770235ee23529c023c50ac5c0d16ecc47c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 19:00:17 +0200 Subject: [PATCH 08/18] build(deps): update rust crate log to 0.4.19 (#5240) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 62dfbeb49..ac17e7906 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1893,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" diff --git a/Cargo.toml b/Cargo.toml index 90f56828d..7f621d0e6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,7 +52,7 @@ gethostname = "0.4.3" 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 } From 847a642d6ac5805348e11f2dce7826f016c67113 Mon Sep 17 00:00:00 2001 From: David Knaack Date: Tue, 13 Jun 2023 22:40:17 +0200 Subject: [PATCH 09/18] chore: fix typos (#5239) --- src/modules/swift.rs | 6 +++--- typos.toml | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/swift.rs b/src/modules/swift.rs index 611410504..1ed11a092 100644 --- a/src/modules/swift.rs +++ b/src/modules/swift.rs @@ -60,10 +60,10 @@ pub fn module<'a>(context: &'a Context) -> Option> { fn parse_swift_version(swift_version: &str) -> Option { // 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()) } diff --git a/typos.toml b/typos.toml index bc511ced4..50bf0feed 100644 --- a/typos.toml +++ b/typos.toml @@ -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/*"] From 796a582f3cc642cef6c5b27b9610e6eb8dd10272 Mon Sep 17 00:00:00 2001 From: David Knaack Date: Wed, 14 Jun 2023 00:06:04 +0200 Subject: [PATCH 10/18] chore: fix new clippy lints (#5241) --- src/configure.rs | 2 +- src/modules/character.rs | 4 ++-- src/modules/hostname.rs | 2 +- src/modules/pulumi.rs | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/configure.rs b/src/configure.rs index 505548999..ec23cf799 100644 --- a/src/configure.rs +++ b/src/configure.rs @@ -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 { diff --git a/src/modules/character.rs b/src/modules/character.rs index c897b4260..20695f63a 100644 --- a/src/modules/character.rs +++ b/src/modules/character.rs @@ -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") diff --git a/src/modules/hostname.rs b/src/modules/hostname.rs index 004cb7a55..d476dcf44 100644 --- a/src/modules/hostname.rs +++ b/src/modules/hostname.rs @@ -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!( diff --git a/src/modules/pulumi.rs b/src/modules/pulumi.rs index 65a89b2a8..093014492 100644 --- a/src/modules/pulumi.rs +++ b/src/modules/pulumi.rs @@ -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); } } From 51591c05f0bb0bb35e2cf3ceaa06e530303a9bbe Mon Sep 17 00:00:00 2001 From: Dosenpfand Date: Wed, 14 Jun 2023 09:46:26 +0200 Subject: [PATCH 11/18] docs: Correct Arch Linux Repo Name (#5243) * Correct Arch Linux repo name * Revert changes to translated files. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 96fa1e000..de6ce0b75 100644 --- a/README.md +++ b/README.md @@ -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`
`dnf install starship` | | Gentoo | [Gentoo Packages] | `emerge app-shells/starship` | | Manjaro | | `pacman -S starship` | @@ -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 From 0cffd59b72adbc4c2c33d6bb14dbca170c775fc4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 23:04:57 +0000 Subject: [PATCH 12/18] build(deps): update rust crate quick-xml to 0.29.0 --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ac17e7906..4a204edf1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2464,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", ] @@ -2912,7 +2912,7 @@ dependencies = [ "pest", "pest_derive", "process_control", - "quick-xml 0.28.2", + "quick-xml 0.29.0", "rand", "rayon", "regex", diff --git a/Cargo.toml b/Cargo.toml index 7f621d0e6..3aae66889 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,7 +64,7 @@ os_info = "3.7.0" path-slash = "0.2.1" pest = "2.6.0" pest_derive = "2.6.0" -quick-xml = "0.28.2" +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"] } From ee92e0dd476bb83480e5a185eea4726e5d2754d9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 14 Jun 2023 18:22:25 +0000 Subject: [PATCH 13/18] build(deps): update reviewdog/action-suggester action to v1.6.1 --- .github/workflows/workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 6340e3b72..3afa01098 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -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 From b6a05fe05eb965864bbdc641335d3252283b8d69 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 14 Jun 2023 18:22:49 +0000 Subject: [PATCH 14/18] build(deps): update rust crate clap to 4.3.4 --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4a204edf1..06a2a0991 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -351,9 +351,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.3" +version = "4.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8f255e4b8027970e78db75e78831229c9815fdbfa67eb1a1b777a62e24b4a0" +checksum = "80672091db20273a15cf9fdd4e47ed43b5091ec9841bf4c6145c9dfbbcae09ed" dependencies = [ "clap_builder", "clap_derive", @@ -362,9 +362,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.3" +version = "4.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acd4f3c17c83b0ba34ffbc4f8bbd74f079413f747f84a6f89292f138057e36ab" +checksum = "c1458a1df40e1e2afebb7ab60ce55c1fa8f431146205aa5f4887e0b111c27636" dependencies = [ "anstream", "anstyle", diff --git a/Cargo.toml b/Cargo.toml index 3aae66889..5333183ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,7 @@ 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.3", 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" From 0871f37d973e5c8993a2fd8a6c993dd612ac3220 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 16 Jun 2023 07:31:33 +0000 Subject: [PATCH 15/18] build(deps): update rust crate serde_json to 1.0.97 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 06a2a0991..c03d1959b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2717,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", diff --git a/Cargo.toml b/Cargo.toml index 5333183ee..d41eb525c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -71,7 +71,7 @@ regex = { version = "1.8.4", default-features = false, features = ["perf", "std" rust-ini = "0.19.0" semver = "1.0.17" serde = { version = "1.0.164", features = ["derive"] } -serde_json = "1.0.96" +serde_json = "1.0.97" sha1 = "0.10.5" shadow-rs = { version = "0.22.0", default-features = false } # battery is optional (on by default) because the crate doesn't currently build for Termux From 0dfca07255323a848bcd88c3c7a6d4ce935c7d28 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 17 Jun 2023 14:06:11 +0200 Subject: [PATCH 16/18] build(deps): update rust crate shadow-rs to 0.23.0 (#5250) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c03d1959b..db1534c4b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2799,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", diff --git a/Cargo.toml b/Cargo.toml index d41eb525c..347c97392 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,7 +73,7 @@ semver = "1.0.17" 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.1", optional = true } @@ -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] From 0a05b5ca8b7f147ead6d575297ef9f34191193af Mon Sep 17 00:00:00 2001 From: Ajeet D'Souza <98ajeet@gmail.com> Date: Sat, 17 Jun 2023 17:36:35 +0530 Subject: [PATCH 17/18] fix(bash): Clear out completed jobs before counting NUM_JOBS (#5253) Clear out completed jobs before counting NUM_JOBS --- src/init/starship.bash | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/init/starship.bash b/src/init/starship.bash index 04d3be96a..370e0b27b 100644 --- a/src/init/starship.bash +++ b/src/init/starship.bash @@ -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 From 0bfaacda2387ab34e1bcc945accda7943ddce3d3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 17 Jun 2023 16:49:13 +0000 Subject: [PATCH 18/18] build(deps): update pest crates to 2.6.1 --- Cargo.lock | 16 ++++++++-------- Cargo.toml | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index db1534c4b..daf5592f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2260,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", @@ -2270,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", @@ -2280,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", @@ -2293,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", diff --git a/Cargo.toml b/Cargo.toml index 347c97392..c3fffb6aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,8 +62,8 @@ 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" +pest = "2.6.1" +pest_derive = "2.6.1" quick-xml = "0.29.0" rand = "0.8.5" rayon = "1.7.0"