1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-11 15:51:01 +00:00
Commit Graph

745 Commits

Author SHA1 Message Date
cubercsl
efb16dd9ca
fix(localip): disable localip module default (#3607) 2022-02-14 09:51:29 -05:00
Kotaro Abe
32aca11c4a
Add option gcloud.project_aliases (#3599)
* feat: gcloud.project_aliases

* feat: add option gcloud.project_aliases
2022-02-14 13:16:45 +01:00
David Knaack
0ea16e2641
fix: ignore empty --jobs argument (#3593) 2022-02-14 13:12:31 +01:00
Rashil Gandhi
e9e090e97e
fix(fish): Emit clear-screen escape sequence only in left prompt (#3588) 2022-02-14 13:11:55 +01:00
Shan Zhou
465e6fc4be
fix(pwsh): Use global:error[0] for most recent error in powershell (#3584)
* Use global:error[0] for most recent error

The current version use $error[0], which is for the module instead of the global status and is always $null, so the $lastExitCodeForPrompot is always $origLastExitCode (see https://github.com/starship/starship/issues/3485 for a related bug).
It should be replaced with $global:error[0] 
Comments are also updated

* fix(pwsh): make Semantic PR bot happy
2022-02-11 12:07:50 +01:00
Jesús Lapastora
c3cc40d2ac
feat(cli): Print arguments if argument parsing fails (#3560)
* fix(#3554): Print the command line argv on clap error

This is a very bare implementation that just prints the error
and then a note with the arguments passed, it does this manually
and doesn't use clap. I've also chosen to use `Vec`'s `Debug`
implementation instead of rolling my own one because I thought it was
good enough, but there might be a better way of doing all this.

Altogether, I think this will be very useful to help in the diagnostic
of other bugs :)

* fix(#3554): Print the command line argv on clap error

This is a very bare implementation that just prints the error
and then a note with the arguments passed, it does this manually
and doesn't use clap. I've also chosen to use `Vec`'s `Debug`
implementation instead of rolling my own one because I thought it was
good enough, but there might be a better way of doing all this.

Altogether, I think this will be very useful to help in the diagnostic
of other bugs :)

EDIT: removed `dbg!`, set it to exit always.

* correctness(exit): don't print argv / exit with error on help and
version error kinds

* fix: Avoid panicking when stdout/stderr closing unexpectedly

* refactor(cli): use `use_stderr` instead of manual match for error kinds

`clap` uses `use_stderr` to reliably check whether the error given is
actually an error coming from user input or rather a hint to display
other info (version, help, etc.)

Also reworded/moved a couple of comments so that they explain better
what is the thought process behind the code
2022-02-06 23:04:28 +01:00
Coelacanthus
589576d3eb
refactor(zsh): using add-zsh-hook instead of add hook manually (#3537)
[1]: https://github.com/starship/starship/pull/3480#discussion_r790280291
[2]: https://zsh.sourceforge.io/Doc/Release/User-Contributions.html#Writing-Themes

Signed-off-by: Coelacanthus <coelacanthus@outlook.com>
2022-02-05 22:37:34 -08:00
moko256
bbdb584f45
fix(status): Enable to convert from i64 to hex_status by casting instead of parsing status. (#3462)
* fix(status): Enable to convert from i64 to hex_status by casting instead of parsing status.

* Apply comment to src/context.rs

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

* Update README.md in configuration

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2022-02-05 21:13:42 +01:00
Segev Finer
0b184c3ccb
feat(pwsh): Set ExtraPromptLineCount (#3439)
* feat(pwsh): Set ExtraPromptLineCount

Fixes #3419

* Rename $prompt to $promptText
2022-02-05 21:12:47 +01:00
Marlon Richert
aaf4c17122
refactor: Improve compatibility with Zsh prompt theme system (#3480)
Zsh's `promptinit` expects a theme's hook functions to be named `prompt_<theme>_<hook>`. See 2876c25a28/Functions/Prompts/promptinit (L155)
2022-02-03 21:53:38 +01:00
Kevin Song
5efb78bcd3
fix: Correctly detect older versions of powershell in bug-report (#3543)
* Factor out the shell version function

* Correct command to trim spaces + header
2022-02-03 21:51:39 +01:00
Marc Schreiber
dcf66659d0
feat: Enable Undistract Me for Linux (#3547)
In #1019 the undistract feature has been added to starship without
enabling it by default due to the system dependency on libdbus. With
recent versions of notify-rust the dependency is no longer required and
the feature can be enabled by default.
2022-01-31 15:28:13 -06:00
QuiCkSTaR
5a26355b0e
feat(localip): add module to print the current ipv4 address (#3289) 2022-01-30 21:31:26 +01:00
Kevin Song
6e24358052
fix(bash): Restore previous exit status in bash init (#3521)
* fix: Restore previous exit status in bash init

* Do it correctly this time
2022-01-30 10:52:51 +01:00
TrickyPi
65f29754d3
fix(nodejs): use e718 as the default of symbol in node configuration (#3533)
* fix: use e718 as the default of symbol in node configuration

* wip: change nodejs symbol in docs/config & add a nodejs symbol configuration in docs/presets

* wip: update CONTRIBUTING.md
2022-01-30 10:28:00 +01:00
Lyndon Sanche
e680540cfc
feat(cmd_duration): Make notification timeout configurable (#3515)
* Allow customization of notification timeout

* Document new notification duration option

* Check for out-of-bounds timeout and correct it

* Implement ModuleConfig for u32

* Revert "Check for out-of-bounds timeout and correct it"

This reverts commit 52109ab5f7c336b55c81bccafb3adbfc81514553.

* Switch notification_timeout to u32

* Note notification_daemons might not honor timout

* Notification timeout defaults to daemon timeout

* Leave default value of notification_timeout blank in docs
2022-01-29 22:56:55 +01:00
David Knaack
6ca911b9fe
fix(elvish): use $pwd for logical-path (#3534)
The `$PWD` environment variable used by starship is not updated on startup by `elvish`. `elvish` also provides a separate `$pwd` variable that does get updated and seems to be be a better indicator for the current logical path.
2022-01-28 21:48:10 +01:00
Joseph Chung
b99d3b8e24
feat: starship bug-report sets syntax highlighting for config file (#3529)
Set the syntax highlighting for the config file in starship bug-report, using the triple backtick syntax.
2022-01-28 14:17:49 +03:00
Aaron Friel
568d057032
feat: add username to Pulumi module (#3428)
* feat: add username to Pulumi module

* run dprint fmt
2022-01-25 10:40:44 -06:00
Kevin Song
08b5ad94fd
ci: Fix aws::expiration_date_set_from_file race (#3484)
* ci: Fix aws::expiration_date_set_from_file race

While aws::expiration_date_set_from_file will almost-always work
perfectly locally, it is theoretically possible for the thread running
the test to be scheduled away betwen writing the file with timing
information and then actually reading it, resulting in a
shorter-than-expected time appearing in the module. This can also happen
if the test triggers right at the very end of a second (e.g. at
10:45:47.999995).

This appears to actually happen sometimes on heavily-loaded GitHub
Actions runners. To fix this issue, we allow for up to a two-second
delay between when the file is written and when the test actually fires
(allowing "30m", "29m59s", and "29m58s" as possible values).

* Fix typo
2022-01-22 12:54:04 +01:00
Harald Hoyer
4f46411403
feat: add a container indicator (#3304)
* test: add mock method for absolute files

Signed-off-by: Harald Hoyer <harald@hoyer.xyz>

* feat(module): add a container indicator module

Adds a container type indicator, if inside a container,
detected via the presence of some marker files.

E.g. inside a podman container entered with `toolbox enter`
the prompt changes to the container name and version.

```
starship on  container_rebased [$!] is 📦 v1.0.0 via 🦀 v1.56.1
❯ toolbox enter

starship on  container_rebased [$!] is 📦 v1.0.0 via 🦀 v1.56.1
⬢ [fedora-toolbox:35] ❯
```

Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
2022-01-21 09:44:46 -06:00
moko256
0d573ac5ea
perf(elvish): Use built-in randint instead of starship session. (#3479) 2022-01-21 08:08:14 +01:00
Segev Finer
7e32fd952e
feat(pwsh): Set STARSHIP_SHELL to pwsh on PS >5 (#3443)
* feat(pwsh): Set STARSHIP_SHELL to pwsh ON PS >5

This is needed for the custom module to use the correct shell.

Closes #3376

* Update src/context.rs

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

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2022-01-16 20:28:26 +01:00
David Knaack
0fd6f05da4
fix(properties): fix regressions in status, pipestatus and terminal-width handling (#3399) 2022-01-15 04:21:38 -05:00
David Knaack
8985499c95
fix: allow compilation without battery feature (#3435) 2022-01-14 22:12:10 +01:00
Segev Finer
0b6ffca35d
fix(pwsh): Avoid polluting the global function namespace (#3424)
* fix(pwsh): Avoid polluting the global function namespace

This is an alternative to #3386

* Review changes

* Move continuation prompt after setting starship env
2022-01-14 21:54:29 +01:00
David Knaack
673a198176
fix(bug-report): remove git.io link shortening (#3425) 2022-01-14 15:22:36 +03:00
Rashil Gandhi
c335b4267b
feat: add support for cmd (#3277)
* feat: add support for cmd

* add preprompt and precmd support

* add keymap support

* add info about minimum Clink version

* simplify escaping

* add handling for cmd custom commands

* add support for transient_prompt and transient_rprompt

* Revert 914057952508e81e20086fcb707ba2a0be85fdd3

This reverts commit "add support for transient_prompt and transient_rprompt"

* Apply suggestions from code review

* disable cmd shell custom commands

* any shell other than cmd can be used

* better error and correct script location

* move shell check in `map_no_escaping`
2022-01-09 23:47:53 -06:00
moko256
500dc3ea6e
feat(elvish): last command status (#3403) 2022-01-06 22:00:38 +01:00
David Knaack
20cf200c3a
refactor: update clap to v3 (#3370) 2022-01-04 12:49:42 +03:00
David Knaack
35eae3fb4a
refactor(process_control): switch to new API (#3385) 2022-01-03 09:14:19 -05:00
Zhong Liu
295948bc6c
feat(package): support for dart pub version (#3373)
* feat(package): add support for dart pub version

* feat(package): add doc for dat pub version
2022-01-01 23:57:20 +01:00
Matan Kushner
800fbec0cf
fix: update continuation prompt to be more minimal (#3374)
Co-authored-by: Kevin Song <chips@ksong.dev>
2022-01-01 14:39:08 -05:00
Ryan Cohen
4deaa02d6f
feat: set a continuation prompt for supporting shells (#3322)
* feat: set a continuation prompt for supporting shells (#3134)

* docs: fixed wording of documentation

* fix: continuation prompt is now only set once

* fix(docs): fixed typo in advanced-config/README.md

Co-authored-by: Segev Finer <segev208@gmail.com>

* fix: update --continuation argument

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

* fix: updated continuation prompt

- PROMPT2 was fixed to be set only once in zsh.
- `continuation_symbol` and `continuation_format` were removed in
  place of a single variable; `continuation_prompt`.
- The continuation prompt was moved out of the character module.

* fix: ran rustfmt

* docs: updated continuation prompt docs

Co-authored-by: Segev Finer <segev208@gmail.com>
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2022-01-01 14:12:11 +01:00
David Knaack
2b405042b9
feat(xonsh): support rprompt (#3362) 2021-12-31 08:23:01 +01:00
Ikko Ashimine
c5a5fc2820
chore(directory): fix typo (#3364)
seperators -> separators
2021-12-31 08:22:46 +01:00
David Knaack
3b7446fdf3
fix(rust): fix overrides on windows and set cwd (#3359) 2021-12-30 18:24:21 -06:00
arcnmx
a95332485b
perf(git_status): tweak exec flags to omit unnecessary info (#3287)
* perf(git_status): tweak flags to omit extra info

`git status` can be prohibitively slow on some repos, so allow the
config to influence what flags are passed to git. For instance, if there
is no configured symbol for untracked files, tell git to omit them from
its output. This can easily result in a 2~10x speedup in many cases, but
requires the user to opt-in to hiding information from the prompt.

* docs(git_status): add ignore_submodules option
2021-12-30 15:12:53 -06:00
Segev Finer
1c305c9de7
feat(directory): Windows path formatting via path_slash::PathBufExt (#3157)
* feat: Experimental Windows path formatting via path_slash::PathBufExt

* Rework the slash path conversion into a real PR

* Add a test for convert_slash = false

* Attempt fixing CI failures

* Fix lint and fmt

* Fix docs/config/README.md getting messed up

* Rename convert_slash/from_slash

* Move convert_path_sep calls in tests

* Keep path_vec immutable

* Run rustfmt
2021-12-30 09:57:13 +01:00
Maximous Black
f48c7a26cf
feat(deno): detect deno.json and deno.jsonc (#3220)
* feat(deno): detect `deno.json` and `deno.jsonc`

* update docs

* update tests

* cargo fmt

* revert lockfile changes

* revert doc updates to non-english files

* Restore README.md

* fmt
2021-12-30 09:55:46 +01:00
David Knaack
67cddb616b
fix(elvish): upgrade shell integration for v0.17 (#3310) 2021-12-30 09:49:55 +01:00
Denis Cornehl
c63e9a71bd
perf(rust): additionally check rustup default for faster result. (#3354)
* perf(rust): additionally check `rustup default` for faster result.

After checking directory overrides we were directly falling back to the
relatively slow call to `rustc --version`.

Inserting a call to `rustup default` leads to a quicker response.

* use `context.exec_cmd` instead of `create_command`
2021-12-28 21:10:49 +01:00
David Knaack
af98f5b8ce
fix: set cwd for command execution (#3309) 2021-12-27 23:56:06 -06:00
Zhong Liu
8d0cebdcbd
fix(dart): detect version output in stdout with dart 2.15+ (#3349) 2021-12-24 09:43:07 -05:00
Mika Fischer
cb40787e2a
feat(status): Add hex_status (#3312) 2021-12-21 05:05:28 -05:00
Lucien Fiorini
a8579d6f2f
fix: Display durations of 0ms (#3121)
Previous code would render all components as empty, resulting
in an empty string even if min_time was 0. This adds a special
case which forces prompt to render "0ms"
2021-12-20 15:58:25 -06:00
Denis Cornehl
006fbf0dd5
fix(aws): prevent endless loop when AWS config file is a directory (#3335)
When opening a directory as a file the intial open works, while
subsequent line-reads will fail with _is a directory_.
Since erroring line-reads were just skipped this lead to an
endless loop.
2021-12-20 21:15:00 +01:00
Mika Fischer
b21904c9d3
fix: Store $? and $LASTEXITCODE first in PowerShell (#3316)
These need to be stored before calling any PowerShell function or executable.
Otherwise the values will be overwritten and cannot be properly restored
or passed to starship.

Fixes: #3315
2021-12-13 10:15:02 +01:00
David Knaack
b4a14e3a80
test(hostname): fix trim_at test with unicode hostname (#3295) 2021-12-09 22:15:25 +01:00
Mikkel Mork Hegnhoj
365b295433
feat(azure): Azure module (#3275)
* Azure module

* make Semantic PR bot happy

* Responding to review

* Changing severity of logging event
2021-12-06 23:01:33 +01:00