Commit Graph

996 Commits

Author SHA1 Message Date
David Knaack
aa05a1e5ab
chore: fix rust 1.79 lint warnings (#6034)
* chore: fix rust 1.79 lint warnings

* chore: update config-schema
2024-06-22 09:52:46 +02:00
David Knaack
8c75822d43
fix(k8s): don't trigger if scan config is set but env vars are not (#5979) 2024-06-09 09:55:13 +02:00
DerRockWolf
478d5cccb6
fix(direnv): replace nonexistent "orange" color with "bright-yellow" (#5969)
* Fix direnv config: change style from nonexistent "bold orange" to "bold bright-yellow"

* generate config-schema.json

* fix tests
2024-06-02 15:24:12 +02:00
John Hooks
5facd85da5
feat(nats): Add NATS Context (#5900)
---------

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2024-05-15 18:46:14 +02:00
William Veal Phan
2221a88f5a
perf(scala): use scala-cli first to avoid timeout (#5952)
fix(scala): use scala-cli first to avoid timeout
2024-05-12 20:32:08 +02:00
Koichi Murase
fe1a8df6fa
fix(bash): fix handling of the preserved DEBUG trap (used in Bash <= 4.3) (#5908)
* refactor(bash): use `STARSHIP_*` for the internal variable names

The current codebase uses `dbg_trap` to save the original DEBUG trap
in bash <= 4.3.  However, the variable name possibly conflicts a user
variable since it is not prefixed by `_starship` or `starship_` or
`STARSHIP_`.  In this patch, we rename `dbg_trap` to
`STARSHIP_DEBUG_TRAP` following other variables of
`STARSHIP_EXIT_STATUS` and `STARSHIP_PIPE_STATUS`.  We also rename the
variable `_PRESERVED_PROMPT_COMMAND` to `STARSHIP_PROMPT_COMMAND`.

* fix(bash): correctly extract DEBUG trap with spaces

* fix(bash): evaluate DEBUG trap by eval

The current code executes the saved DEBUG trap just by
$_starship_dbg_trap.  This causes various problems.  The content of
the variable `_starship_dbg_trap` is unexpectedly subject to the word
splitting with the pathname expansions. Also, the needed shell
expansions and quote removal are not performed.  With a custom IFS,
the content of the variable will be split in an unexpected way.  The
saved DEBUG trap needs to be executed by eval "$_starship_dbg_trap".
2024-04-16 08:16:00 +02:00
Michael Feist
de5b7f041a
fix(xonsh): remove | cat workaround from xonsh init (#5113) 2024-04-14 17:02:00 +02:00
Thomas O'Donnell
e3b5dff352
feat(k8s): Add detect env vars option (#4488)
* feat(k8s): Add detect env vars option

Have added the option to trigger the k8s module based on what env vars
are set, this has been done in a backwards compatible way so if nothing
is changed from the defaults the module will still behave the same way
as before. This is similar to what I did in #4486 for the python module
and if goes well I'd like to rollout to other modules.

* Update src/modules/kubernetes.rs

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

* Update src/modules/kubernetes.rs

---------

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2024-04-06 15:30:19 +02:00
cgzones
3e3f18ef27
feat(container): show name if available (#5195)
Podman exports the name of the container in /run/.containerenv, which is
especially useful for distrobox environments.
2024-04-06 15:29:24 +02:00
Daniel Watkins
1a72757f01
fix: combine ANSI color codes before wrapping them (#5762)
* combine ANSI color codes before wrapping them

The existing code wraps each individual module's output for
`context.shell`, concatenates all that output together and passes it to
`AnsiStrings` to merge ANSI color codes.  However, the wrapping obscures
ANSI color codes, meaning that no merging is possible.

This commit changes the shell-specific wrapping to happen right before
output, once all modules' output has been concatenated together.  This
results in ANSI color codes being correctly merged, as well as reducing
the number of calls to `wrap_colorseq_for_shell` to one.

With a minimal `starship.toml`:

```
format = """$directory"""

[directory]
format = '[a]($style)[b]($style)'
```

The current code produces[0]:

```
\n%{\x1b[31m%}a%{\x1b[0m%}%{\x1b[31m%}b%{\x1b[0m%
```

And this commit's code:

```
\n%{\x1b[31m%}ab%{\x1b[0m%}
```

You can see that the current code emits an additional reset and repeated
color code between "a" and "b" compared to the new code.

[0] Produced in a Python shell with:

```
subprocess.check_output(
    "./target/debug/starship prompt", shell=True,
    env={"STARSHIP_CONFIG": "./starship.toml", "STARSHIP_SHELL": "zsh"}
)
```

* utils: return early from wrap_seq_for_shell unless wrapping required

* refactor(utils): simplify wrap_seq_for_shell

This commit modifies wrap_seq_for_shell to (a) return early for shells
with no wrapping required, and (b) determine the wrapping characters
once at the start of the function (rather than inline in the map
function for every character).
2024-04-06 15:28:26 +02:00
Alper Cugun
9c1eaddae1
feat(username): add aliases option (#5855)
* Create place to put it in the config

* Initial functional version

* Fix grammar

* Add option documentation to README

* Add test for two aliases and emoji translation

* Remove println

* Rewrite match as iflet

* Improve converting the reference

* Format file

* Try to restore autoformat of markdown

* Replace toml:Map with concrete IndexMap

* Update schema

* Add option that got lost
2024-04-05 23:57:13 +02:00
[Error_27]
335c514e9e
feat(odin): Add Odin Lang module (#5873)
* Add Odin lang module

* add utils string and remove commit number from output

* switch to new symbol because ZWJ support is rare

* add config docs

* add option to show the commit number

* fix lack of trimming

* fix formatting to comply with checks

* Add trailing newline to comply with cargo fmt

* Add new Odin test and add newline in cmd output
2024-04-05 23:56:49 +02:00
boreinhardt
34a8f7e628
feat(gleam): Add Gleam module (#5886)
Co-authored-by: benno.reinhardt <benno.reinhardt@silbury.com>
2024-04-05 23:56:15 +02:00
Koichi Murase
0f859e8b61
fix(bash): use eval instead of a procsub for the POSIX mode (#5020)
fix(bash): use eval instead of a procsub for the POSIX mode
2024-04-02 10:45:02 +02:00
Ramy
be4e97c2d9
fix(bun): change default icon (#5880)
* feat: change bun icon #5871

* fix: reverts docs
2024-03-30 09:38:19 +01:00
David Knaack
796a411602
fix: replace unmaintained crates yaml-rust, dirs-next (#5887) 2024-03-29 12:14:57 +01:00
David Knaack
d5861f9f97
fix: replace all remaining paths referring to vuepress (#5859) 2024-03-24 08:03:55 +01:00
David Knaack
df65b2155f
feat(os): add new os symbols (#5849) 2024-03-21 12:39:28 +01:00
Texas Toland
d308e918ee
fix(nu): continuation prompt not being displayed correctly (#5851)
Resolve #5847 by initializing `$env.STARSHIP_SHELL` before calling `starship`

Most minimal change possible. Other simplification are possible but not know to be
backwards compatible. Also considered `with-env` or `STARSHIP_SHELL=nu starship` but
they'd be worse. Happy to reformat indentation if desired.
2024-03-21 12:38:38 +01:00
David Knaack
ab840439e3
fix(status): fix pipestatus width calculation (#5036)
closes #3162

Co-authored-by: flw <flw@cpan.org>
2024-03-20 22:58:33 +01:00
marcybell
938ea3c401
feat: $gemset variable for Ruby module (#5429)
* $gemset variable for Ruby module

* typo

* Added test for no GEM_HOME env set

* Formatting

* Uses `rvm current` for gemset, no more version num
2024-03-20 22:57:26 +01:00
Virgile Andreani
0e49f04a6b
feat(quarto): Add Quarto module (#5820)
Add Quarto module

* Adapted from the Typst module
2024-03-20 22:50:12 +01:00
Mick Hohmann
b8a812b932
feat(username): add detect_env_vars as option (#5833)
* Added the option "detect_env_vars" to the `username` module

with the same functionality as in the `hostname` module.

* Fixed logic error and added test to catch it

* build(deps): update dependency vitepress to ^1.0.0-rc.45

* build(deps): update rust crate shadow-rs to 0.27.1

* Added the option "detect_env_vars" to the `username` module

with the same functionality as in the `hostname` module.

* Fixed logic error and added test to catch it

* Removed unused gix import

* Removed unused gix import, again

* Removed unused gix import. Next try

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-20 22:47:32 +01:00
David Knaack
0e334e3e6c
chore: fix upcoming rust 1.77 clippy issues and chrono deprecations (#5850) 2024-03-20 18:57:14 +09:00
David Knaack
49575e5a55
build(deps): update toml crates (#5842)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-03-20 18:56:20 +09:00
David Knaack
ae711c0f33
feat(bash): use PS0 for preexec hook (#5735) 2024-03-03 17:59:23 +01:00
David Knaack
7290c5e368
chore: apply clippy for rust 1.76 & bump msrv (#5763) 2024-03-03 17:57:39 +01:00
David Knaack
7485c90c9f
feat(docs): move to vitepress (#5785)
* feat(docs): move to vitepress

* change up hero styles to match existing site

* A bit more style tweaking

* Replace stylus with plain CSS

* improve unicode-range value for nerdfont

---------

Co-authored-by: Matan Kushner <hello@matchai.dev>
2024-03-03 17:55:30 +01:00
Fraser Li
6a96e84a15
fix(git_branch): fall back to "HEAD" when there is no current branch (#5768)
* fix(git_branch): fall back to "HEAD" when there is no current branch

* test(git_branch): add test for branch fallback on detached HEAD
2024-02-26 12:21:00 +01:00
Gilbert Sanchez
0891ec27a4
fix(character): also handle vi edit mode in pwsh (#5775)
* Add missing vi for char for Shell::Pwsh

https://github.com/starship/starship/pull/5478#issuecomment-1886829331
2024-02-19 17:01:51 +01:00
David Knaack
2aa711ccc7
fix(bash): improve integration with bash-preexec (#5734) 2024-02-04 16:02:17 +01:00
David Knaack
428d840bce
build(deps): update rust crate windows to 0.52.0 (#5379) 2024-02-04 16:01:32 +01:00
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