Commit Graph

964 Commits

Author SHA1 Message Date
tricktron 7093d5cd84
fix(bash): Handle Unbound Variables Errors in Bash (#4972)
* fix: unbound bp pipestatus variable

* fix: unbound preserved prompt command variable

* fix: unbound starship start time variable

* fix: unbound preexec_functions, precmd_functions

and PROMPT_COMMAND variables.
2024-01-27 15:08:19 -06:00
Andrew Pantuso 482c7b719f
feat(direnv): use JSON status with direnv >= 2.33.0 (#5692) 2024-01-21 13:56:57 +01:00
Rashil Gandhi 5ead13d6aa
feat(bash): Support right prompt and transience (#4902)
* Support right prompt in bash

* Docs for transience in bash

* Apply suggestions from review

* Simplify conditional

* Use ble.sh hooks, if available

* Properly quote args

* Use BLE_PIPESTATUS

* Update starship.bash

* Update src/init/starship.bash

Co-authored-by: Koichi Murase <myoga.murase@gmail.com>

---------

Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
2024-01-21 13:55:52 +01:00
Xiaohan Ni ef7b773557
test(aws): fix flaky tests `expiration_date_set` `expiration_date_set_from_file` (#5685)
* fix(aws): fix flaky test `expiration_date_set`

* fix(aws): fix flaky test `expiration_date_set_from_file`
2024-01-06 22:49:27 +01:00
David Knaack 2bb57cf0cd
fix(zsh): improve starship binary path escaping (#5574) 2024-01-06 21:19:02 +01:00
Camron Flanders cec111affd
fix(direnv): update to work with direnv v2.33 (#5657)
* update AllowStatus to work with direnv 2.33

direnv now returns int enum instead of boolean, https://github.com/direnv/direnv/pull/1158

* update schema

* maybe fixed the schema now

* Whoops, I inverted the flags somehow

* have coffee, fix mistaken understanding

* undo changes to tranlations

* Update docs/config/README.md

* Update src/modules/direnv.rs

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>

* update test output

---------

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2024-01-06 11:46:25 +01:00
David Knaack a83e10776b
revert: refactor(modules): use whoami crate to get username (#5669)
Revert "refactor(modules): use whoami crate to get username"
2024-01-02 15:45:06 +01:00
Sebastian Thiel cdcfc367b5
build(deps): update rust crate gix to 0.57.0 (#5664)
* build(deps): update rust crate gix to 0.57.0

* chore(context): explicitly avoid erroring on no git-ceiling-dir-match

See: https://github.com/Byron/gitoxide/pull/1191
Co-Authored-By: Sebastian Thiel <sebastian.thiel@icloud.com>

---------

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2023-12-31 15:53:51 +01:00
David Knaack cd0fdb7ce0
chore: apply new rust 1.75 & nightly clippy fixes (#5646)
chore: apply clippy fixes
2023-12-30 17:29:37 +01:00
Andrew Pantuso e47bfbabb9
feat(direnv): add new direnv module (#5157) 2023-12-17 08:22:29 +01:00
Stefan Richter 6d96df3c68
feat(aws): Adding the AWS SSO CLI env variable to profile list (#5640)
Adding the AWS SSO CLI env variable to profile list

Adding support for the profile env variable used by https://github.com/synfinatic/aws-sso-cli
2023-12-17 08:20:58 +01:00
Ananta Bastola a910e094f7
fix(docker_context): ignore unix domain socket path from Docker Context (#5616)
* fix(modules): ignore unix domain socket path from Docker Context

fix #5548

* refactor(docker_context): ignore docker_context on unix domain socket path

Closes #5548
2023-12-17 08:19:43 +01:00
David Knaack 00d3dc86a2
fix(git_status): Avoid printing error on missing stash ref (#5434)
* fix(git_status): Avoid printing error on missing stash ref

* ensure we only proceed if the returned reference has the expected name
2023-12-16 16:58:45 +01:00
David Knaack 64ca07910d
chore: fix rust 1.74 clippy lints (#5578) 2023-11-29 07:27:47 +01:00
William Howard ac4a839103
perf(git_status): avoid running in bare repos (#5581)
* fix: git_status bare repo handling

* perform the git_status bare repo check earlier

* Adjusted test
2023-11-29 07:26:35 +01:00
Jan Gorecki 5267c464eb
feat: R lang packages version, remove .Rprofile from rlang detection (#5588)
* do not detect R for .Rprofile files, closes #2817

* get R package version, #5586

* update schema

* fix and simplify regex for rlang package version

* attempt to fix regex

* proper detect R packages, closes #5590

* reduce diff vs master branch
2023-11-29 07:25:40 +01:00
Gilbert Sanchez d7a34b45f8
feat(shell): allow distinguishing between pwsh and powershell (#5478)
* Distinguish between pwsh and powershell

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2023-11-25 14:06:03 +01:00
Charlotte Thomas 7b217056bd feat: add typst module
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2023-11-12 19:02:31 +01:00
bestgopher b5f9457b28 refactor(modules): use whoami crate to get username
Signed-off-by: bestgopher <84328409@qq.com>
2023-11-11 19:16:49 +01:00
Patrick Stadler 0ed7c6f650 zsh: clear exit code between prompts 2023-11-07 15:27:36 +01:00
Ohad Lutzky 7b851fc30e
feat(scanner): add option not to follow symlinks (#5325)
Add follow_symlinks option

Settings this to false can fix hanging on symlinks to slow/inaccessible
filesystems.
2023-11-02 09:01:09 +01:00
William Howard 81c7d0cc58
feat: add additional exit status code meanings from libc (#5412) 2023-10-13 10:56:28 +02:00
Ariel Barreiro 8168c21293
fix(bash): unbound variable error with STARSHIP_PREEXEC_READY (#5438)
Prevent unbound variable error
2023-10-01 08:54:06 +02:00
Mick Hohmann 43b2d42cd5
feat(hostname): add detect_env_vars as option (#5196)
* Added hostname.detect_env_vars

based on the newly added context::detect_env_vars

- extended context::detect_env_vars to check for negated environment
  variables as well, analogous to the other detect modules
- made hostname.detect_env_vars only active if ssh_only is set to false
  for backwards compatibility

Co-authored-by: Dominik Sander <dsander@users.noreply.github.com>

* added clippy recommendations, removed unneeded comments

* Added new logic (suggested in https://github.com/starship/starship/pull/5196#issuecomment-1566228913)

The new `detect_env_vars` now requires either SSH_ONLY to be false or the
environment variable SSH_CONNECTION to be set, so that is will be used

* Fixed typo

* Refactored the detect_env_vars function for early returns and better readability

* Change boolean logic for better readability

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>

* Apply suggestions from code review to `detect_env_vars` method.

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>

* Fixed bracket error & updated comments

- fixed bracket error in hostname.rs, after changes
- updated comments for context.rs, for the suggested changes

* Removed obsolete warning from docs/config/README.md

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>

---------

Co-authored-by: Dominik Sander <dsander@users.noreply.github.com>
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2023-09-16 16:42:13 +02:00
Jan Katins 6b444e05c6
feat(kubernetes): Add styling based on current context (#4550)
* feat(kubernetes): Add styling based on current context

Add an ability to customize the configuration of the kubernetes module style, based on the current context.

A new variable is added to the config section, called environments, which is a list of possible customizations. Each such customization is an object with a context_pattern regex, which matches context name, and an optional style and icon that will override the global configuration, if the currently used context matched the context_pattern.

Based on multiple attempts to add per-context styling and symbols to the kubernetes module.

- https://github.com/starship/starship/pull/1568 by @lht https://github.com/lht -> base
- https://github.com/starship/starship/pull/614 by @nomaed https://github.com/nomaed -> naming, symbol, some tests

Rebased and combined by @jankatins

Contains the following squasched commits

- Rename to contexts and move aliases into contexts
- Move deprecated functions to a submodule
- Cleanup: ignore None-valued KubeCtxComponents
- Add regex func + clean up matching-context search
- Placate paper clip

Closes: https://github.com/starship/starship/issues/570

Co-authored-by: =?UTF-8?q?Boris=20Aranovic=CC=8C?= <nomaed@gmail.com>
Co-authored-by: Jan Katins <jasc@gmx.net>
Co-authored-by: Kevin Song <chips@ksong.dev>

* refactor(kubernetes): Remove options and use clearer names

* test(kubernetes): Handle duplicated contexts right

* refactor(kubernetes): Cleaner user matching

* fix(kubernetes): Only show warning in case of problems

* feat(kubernetes): Add back alias replacements

* refactor(kubernetes): Cleanup rust usage

---------

Co-authored-by: Haitao Li <lihaitao@gmail.com>
Co-authored-by: =?UTF-8?q?Boris=20Aranovic=CC=8C?= <nomaed@gmail.com>
Co-authored-by: Kevin Song <chips@ksong.dev>
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2023-09-02 09:19:33 +02:00
Vegard Skui e867cda1eb
feat(fossil_metrics): add fossil_metrics module (#4874)
* feat(fossil_metrics): add fossil_metrics module

* Return early if not in a Fossil check-out

* Add more tests for fossil_metrics

* Move is in Fossil checkout check after module enabled check

* Update type for new toml version

* Update the config file schema

* Rework parsing of fossil diff output

* Fix Fossil check-out detection in subdirectories

* Use regex to only match expected fossil diff output

* Use shared ancestor scanning and fix detection on Windows

* Add note on minimum Fossil version
2023-09-02 09:19:04 +02:00
Hugo 5ca8daacd4
perf: Skip unnecessary indirection in starship init zsh (#5322)
Skip unnecessary indirection in starship init zsh

The installation instructions indicate that one should add this snippet
to zsh's configuration:

    eval "$(starship init zsh)"

The command `starship init zsh` prints a little shell script for zsh to
execute:

    > starship init zsh
    source <(/usr/bin/starship init zsh --print-full-init)%

Running `starship init zsh --print-full-init` prints yet another script
that zsh executes. There is an intermediate step that seems redundant;
starship prints a script for zsh to execute, and this script prints
another script for zsh to execute.

This commit skips the intermediate execution and prints the final script
in `starship init`. This is backwards compatible and does not require
any changes in the installation instructions, so it could be release
without a major version bump.

Note that it would still be possible to update the installation
instructions to `source <(starship init zsh)`; this patch works with
both `source` and `eval`. Picking the most performant one is beyond this
scope of this commit.

See: https://github.com/starship/starship/issues/2637
2023-08-31 19:08:13 +02:00
David Knaack 77967148b6
chore: handle rust 1.72 clippy & fmt changes (#5399) 2023-08-25 22:53:35 +02:00
David Knaack 03278e4de4
fix(git): prevent `core.fsmonitor` from executing external commands (#3981) 2023-07-31 21:44:31 +02:00
cgzones 4fa4230dda
refactor(directory): avoid unnecessary string copies (#5313) 2023-07-30 14:32:20 +02:00
Vivek Kushwaha 3402f0e82a
feat(shlvl): add repeat_offset for repeated symbol (#5289)
Signed-off-by: Vivek Kushwaha <yoursvivek@users.noreply.github.com>
2023-07-14 10:59:02 +02:00
David Knaack 410f107c72
perf(git_status): query git stash count via gitoxide (#5238) 2023-07-11 11:26:50 +02:00
David Knaack b9a4b08ac2
fix(rprompt): remove lprompt modules from `$all` again (#5067) 2023-07-06 11:32:17 +02:00
Ajeet D'Souza 0a05b5ca8b
fix(bash): Clear out completed jobs before counting NUM_JOBS (#5253)
Clear out completed jobs before counting NUM_JOBS
2023-06-17 14:06:35 +02:00
David Knaack 796a582f3c
chore: fix new clippy lints (#5241) 2023-06-13 17:06:04 -05:00
David Knaack 847a642d6a
chore: fix typos (#5239) 2023-06-13 15:40:17 -05:00
Nemo157 318050976b
feat(pwsh): Support vi command mode indicator (#5049)
Support vi command mode in powershell
2023-06-12 11:05:44 +02:00
Antoine Stevan 470aeb09a7
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 😌

* 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 😌

* remove code quotes in the `config_cmd` of Nushell

* format the style in the Nushell `warning` section
2023-06-12 11:02:46 +02:00
marcybell 70d2014f34
feat(nodejs): Add `expected_version` variable (#5081)
* add `expected_version` variable to `nodejs`

* show comparison symbols with `expected_version`

* documentation, formatting, more tests

* Remapped `engines_version` to $version

* Added better descriptions to docs

* Update docs/config/README.md

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>

* Removed clone from `nodejs`, formatting

* refactored function calls

* rewrote `engines_version` formatter

* Moved Lazy variables into maps

---------

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2023-06-01 21:24:11 +02:00
marcybell 351bf9d0b3
feat(golang): adding `mod_version` variable (#5177) 2023-06-01 21:18:38 +02:00
Mick Hohmann 2558c4588b
fix: update of presets and default configuration to reflect changes in Nerd Fonts 3.0 (#5162)
* Updated nf-mdi-* to nf-md-* symbols

The following symbols where changed
- directory.read_only
- memory_usage
- meson
- nim
- os.symbols.Garuda
- os.symbols.HardenedBSD
- os.symbols.Illumos
- os.symbols.OpenBSD
- os.symbols.OracleLinux
- os.symbols.Redox
- os.symbols.Solus
- os.symbols.Windows
- package
- rlang

* Updated nf-mdi-* to nf-md-* symbols (for all other presets)

The following symbols where changed
for pastel-powerline:
- directory.substitutions.Documents
- nim
for tokyo-night
- directory.substitutions.Documents
- golang

* Updated nf-mdi-* to nf-md-* symbols for the default configuration in modules in src/configs/*.rs

The following symbols where changed
- azure
- battery.full_symbol
- battery.charging_symbol
- battery.discharging_symbol
- battery.unknown_symbol
- battery.empty_symbol

* Updated config-schema.json

* Updated src/modules/*.rs docs/config/README.md

and used `nerdfix` to check if I overlook anything

* Fixed the battery discharging symbol in the tests

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: jtrv <travershasemail@gmail.com>
2023-05-10 14:36:56 +02:00
Denis Cornehl d07a8e3668
feat(gcloud): add `detect_env_vars` option (#5166)
* feat(gcloud): add `detect_env_vars` option

* regenerate config schema
2023-05-09 07:55:49 +02:00
kensasongko 297176b0b8
feat(aws): support aws sso with automatic authentication refresh (#5170)
* feat(aws): support aws sso with automatic authentication refresh

* docs(aws): add sso_session for profile detection
2023-05-09 07:53:45 +02:00
Sebastian Thiel 8884bd1fd0
build(deps): upgrade gitoxide to v0.44 for performance improvements during discovery (#5141)
upgrade gitoxide to v0.44 for performance improvements during discovery

Please note that there is a new `dot_git_only` option which would further
speedup discovery. On even moderatly fast disks that probably not going
to make a difference, but it will on incredibly slow (networked) disks.

See https://github.com/helix-editor/helix/issues/6867 for reference.
2023-04-27 21:14:34 +02:00
marcybell b8a167db57
refactor(Context): `set_config` method for `Context` (#5079)
* add `set_config` method to `Context`

* Made inline comment a doc comment

* use `default_context()` for `set_config()` test

* use `set_config()` in tests for `print.rs`

* set root config w `set_config()` (`print.rs` test)
2023-04-24 16:03:47 +02:00
Andrew Pantuso e5cec9ea50
fix(style): ensure nested style variables are processed during formatting (#5120)
fix: ensure nested style variables are processed during formatting
2023-04-24 16:03:04 +02:00
Dom Slee ce7f984932
fix(config): Make print-config not panic without a config (#5001) 2023-04-13 19:29:21 -05:00
AnirbanHalder654322 b2ebd5b50c
feat: Add Solidity Module (#5047)
* Adding documentation

* Documentation and schema addition

* Creating solidity config

* Module for solidity lang

* Updating all the files

* Changing according to clippy

* Fixing misspellings

* Changes suggested by clippy

* Updating schema , maybe fixing docs workflow error

* Updating schema

* Removing solcjs from default compiler list

* Fallback test added and test string fixed

* Fixing docs

* Updating schema

* Updating schema

* Fixing docs

* Updating schema

* Updating schema

* Typo fix

* Update docs/config/README.md

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>

* Update src/utils.rs

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>

* Fix build commit

---------

Co-authored-by: Anirban Halder <shaeo967@gmail.com>
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2023-04-13 21:05:12 +02:00
Colton Donnelly ce01423152
feat(git_metrics): add option to ignore submodules (#5052)
* add docs

* update schema

* ok, actually update schema

* add test

* fix lint

* accidentally included my .devenv directory
2023-04-13 21:04:15 +02:00
marcybell 27ffa37cfd
feat(azure): subscription name aliases (#4949)
* From issue #4448, added `subscription_aliases`
as a field for the Azure module

Can be set in starship.toml with
[azure.subscription_aliases]

* Updated config file schema

* Added entry into documentation

* Update README.md

* Formatted with dprint
2023-04-13 21:03:14 +02:00