Commit Graph

726 Commits

Author SHA1 Message Date
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
arcnmx e3a88a6ec1
fix(git_branch): more robust handling of .git (#3290) 2021-12-03 15:15:31 -05:00
pejax 1109fd6997
feat: Add package version detection for sbt projects (#3274) 2021-12-03 01:56:06 -05:00
David Knaack 77182a9a22
chore(clippy): fix new clippy lints (#3294) 2021-12-03 00:54:56 -06:00
David Knaack e18c61cd68
fix(directory): improve truncation detection (#3266) 2021-11-26 13:07:28 +01:00
Ikko Ashimine 337154ad35
chore: fix typo in docker_context.rs (#3265)
enviroment -> environment
2021-11-23 17:56:16 +01:00
Gabriel Victor 779e53cd66
feat(module): Add `sudo` module (#3135)
* add feature - sudo module

* add sudo module identifiers and entry point

* fix test test_sudo_not_cached

* add test test_sudo_cached

* add `allow_windows` and `binary` options

* rustfmt sudo_x_cached and rmv them on windows

* add false `allow_windows` block windows test

* add `doas` cached/not_cached tests

* better description in `starship explain`

* fix `test_doas_cached` with `-n` flag

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

* rmv `binary` alternatives and their tests

* fix symbol and update config/README

* fix all mocks to use `sudo -n true`

* fix expected output in `test_sudo_cached`

* proper checking for blocked sudo

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

* add `allow_windows = true` to non-windows tests

* allow sudo_* tests to run on windows + fix parsed

* rustfmt `blocks_windows` test

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2021-11-15 06:46:13 +01:00
Matthew Donoughe c3e33ea1c7
feat: print-config subset of config (#3179)
* feat: print-config subset of config

* only print format helpers with format config

* improve help text

* also change argument name
2021-11-15 06:45:19 +01:00
David Knaack 6068bab872
build: bump toml_edit from 0.6.0 to 0.8.0 (#3225)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-11 05:58:47 -05:00
cbolgiano 8d80d2ef06
feat(python): Show value of PYENV_VERSION when present (#3144)
* 2872: Show value of PYENV_VERSION when present

* 2872: Run cargo fmt
2021-11-09 21:55:53 +01:00
Derek Wilson 8ae6548dc0
fix: save pipestatus in fish init functions (#3160) 2021-11-09 14:27:30 -05:00
t-mangoe b07abc990e
feat: style git repo root (#2010) 2021-11-09 14:12:40 -05:00
Matan Kushner 9df7c7d256
fix: replace battery with starship-battery (#3213) 2021-11-09 06:35:45 -05:00
Aaron Kollasch d1ce352528
feat(ruby): Add environment variable checks to ruby module (#3206)
* feat(ruby): Add environment variable checks to ruby module

* docs(ruby): describe version detection method
2021-11-08 21:21:09 +01:00
David Knaack 4ee1bdc2a4
fix(memory_usage): remove duplicate `%` handling (#3193) 2021-11-01 22:19:27 +01:00
Fred Cox c1f2d345aa
fix(escaping): move escaping to individual variables (#3107) 2021-11-01 22:18:45 +01:00
David Knaack 6e6ab9f212
fix: ignore scan_dir timeout in tests (#3184) 2021-10-30 10:52:48 +02:00
David Knaack c4439531d3
fix: only print root level config logs a single time (#3132) 2021-10-27 15:13:17 +02:00
Thomas O'Donnell 39e7b78cb2
feat: also read from DOCKER_MACHINE_NAME (#3175)
This adds support to also read the context from `DOCKER_MACHINE_NAME`
since it is a bit more user friendly.
2021-10-25 07:54:39 +02:00
David Knaack 48fca507f5
fix(configure): preserve formatting and comments (#3152)
* fix(configure): preserve formatting and comments

* preserve formatting in changed line

* add tests
2021-10-23 10:15:46 +02:00