1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-05 04:47:58 +00:00
Commit Graph

1353 Commits

Author SHA1 Message Date
Benjamin Fox
20d845f9b3
refactor(directory): Introduce logical-path argument which allows a shell to explicitly specify both a logical and physical filesystem path (#2104)
* refactor(directory): Introduce `logical-path` argument which allows a shell to explicitly specify both a logical and physical filesystem path

Fix `directory::module` to consume both path and logical-path (if provided).  The "logical" path is preferred when rendering the "display path", while the "physical" path is used to resolve the "read only" flag. Repo- and home-directory contraction behavior is maintained, based on the logical path if it is set, or the physical path if it is not.

The custom "get_current_dir" logic has been removed entirely, and the `directory` module now relies on `context.current_dir` / `context.logical_dir` entirely.

Changes have been made to `init/starship.ps1` to work with this new flag:
- Calculate and pass "physical" and "logical" paths explicitly (as other shells do not pass `--logical-path` that they fall back to rendering the physical path)
- Moved the "powershell provider prefix" cleanup code to the PowerShell script - this code _should_ now support any kind of powershell path prefix.

* fix(powershell): Fix an issue with trailing backslashes on file paths causing command line parsing issues.

This is a bit of a footgun!
The work-around chosen is to append a trailing space when a path string ends with a backslash, and then trim any extra whitespace away in the Context constructor.
Other alternatives considered and rejected:
1. Always trim trailing backslashes as the filesystem generally doesn't need them.
2. Escape trailing backslashes with another backslash. This proved complex as PS only quotes string args when the string includes some whitespace, and other backslashes within the string apparently don't need to be escaped.

* fix(powershell): Use Invoke-Native pattern for safely invoking native executables with strings which may contain characters which need to be escaped carefully.

* fix(context): Remove superfluous argument trims

These were in place to clean up extra whitespace sometimes injected by starship.ps1::prompt, and are no longer required with the new Invoke-Native helper in place.

* refactor(directory): Clean up the semantics of `logical_dir` defaulting it to `current_dir` but overridable by the `--logical-dir` flag.

- Restore `use_logical_path` config flag.
- Always attempt to contract repo paths from the `current_dir`.

* fix(directory) :Use logical_dir for contracting the home directory

This keeps the two calls to contract_path in sync.

* fix(directory): Remove test script

* refactor(directory): Convert current_dir to canonical filesystem path when use_logical_path = false

- This requires some clean-up to remove the extended-path prefix on Windows
- The configured logical_dir is ignored entirely in this mode - we calculate a new logical_dir by cleaning up the physical_dir path for display.
- Test coverage

* fix(directory): Use AsRef style for passing Path arguments

* fix(directory): Strip the windows extended-path prefix from the display string later in the render process

* fix(docs): Update docs/config/README.md for use_logical_path

* refactor(context): Populate `current_dir` from `--path` or `std::env::current_dir`, populate `logical_dir` from `--logical-path` or the `PWD` env var

- `current_dir` is always canonicalized
- On Windows, `current_dir` will have an extended-path prefix
- `logical_dir` is now always set
- `directory::module` now just selects between `current_dir` and `logical_dir` when picking which path to render
- Test coverage

* fix(directory): Fix path comparison operations in directory to ignore differences between path prefixes

- Added PathExt extension trait which adds `normalised_equals`, `normalised_starts_with` and `without_prefix`

* fix(path): Add test coverage for PathExt on *nix

* fix(directory): Test coverage for `contract_repo_path`, `contract_path` with variations of verbatim and non-verbatim paths

* fix(directory): Update path-slash to latest

This fixes the issue with the trailing character of some Windows paths being truncated, e.g. `\\server\share` and `C:`

* fix(powershell): Improve UTF8 output handling, argument encoding

- Use `ProcessStartInfo` to launch native executable, replacing manual UTF8 output encoding handling
- If we detect we're on PWSH6+ use the new `System.Diagnostics.ProcessStartInfo.ArgumentList` parameter, otherwise manually escape the argument string
- Move `Get-Cwd` and `Invoke-Native` into the prompt function scope so that they don't leak into the user's shell scope

* fix(path): Make PathExt methods no-ops on *nix

* fix(path): Cargo fmt

* fix(powershell): Remove typo ';'. Fix variable assignment lint.
2021-02-08 15:14:59 +01:00
dependabot-preview[bot]
30bd02c9cf build(deps): bump serde_json from 1.0.61 to 1.0.62
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.61 to 1.0.62.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.61...v1.0.62)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-08 05:45:45 +00:00
Thomas O'Donnell
da4bd401c4
feat(python): Configure when the module is shown (#2264)
This makes it possible to configure when the python module is shown
based on the contents of a directory. This should make it possible to
be a lot more granular when configuring the module.

This includes a breaking change since we are removing the
`scan_for_pyfiles` configuration option in favour of setting the
`detect_extensions` to an empty array.
2021-02-07 22:18:52 +01:00
Matan Kushner
f9bebc9ab8
docs(i18n): New Crowdin updates (#2219) 2021-02-06 12:46:15 -05:00
David Knaack
edb17bc5c7
ci: fix changelog generation (#2267) 2021-02-04 20:29:41 -05:00
dependabot-preview[bot]
57071ac53f build(deps): bump quick-xml from 0.20.0 to 0.21.0
Bumps [quick-xml](https://github.com/tafia/quick-xml) from 0.20.0 to 0.21.0.
- [Release notes](https://github.com/tafia/quick-xml/releases)
- [Changelog](https://github.com/tafia/quick-xml/blob/master/Changelog.md)
- [Commits](https://github.com/tafia/quick-xml/compare/v0.20.0...v0.21.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-04 06:02:10 +00:00
Dan Tsekhanskiy
2bc8a7172d
docs(status): Remove status_ prefix from status module variables (#2260)
* Remove status_ prefix from status module variables

* Revert "Remove status_ prefix from status module variables"

This reverts commit f4c6e9ced3040ef2939189afe7ff8bd08d6fae78.

* docs: Remove status_ prefix from status module variables
2021-02-03 18:52:15 +01:00
Matan Kushner
0558b38e3f
chore(release): v0.50.0 2021-02-02 14:59:42 -05:00
KOVACS Krisztian
c9c3455e23
fix(windows): fix windows terminal ANSI escape sequences (#2258)
* fix(windows): don't inherit stdin when executing commands

On Windows, inheriting stdin from starship might lead to leaking the
console reference to the command we're executing. `id.exe` supplied with
Git has been observed to disable the ENABLE_VIRTUAL_TERMINAL_PROCESSING
console flag if it inherits stdin -- leading to Windows Terminal not
processing ANSI escape sequences.

This change fixes #2254 by explicitly disabling stdin inheritance.

The fix was suggested by David Knaack.

* fix(username): don't call `id -u` on Windows

This was done to check if user is root by comparing the UID to 0. Windows
does not have a concept of UID 0 anyway, so it's pointless to call `id.exe`
(which is installed with MSYS2 or Git, for example).
2021-02-02 14:58:18 -05:00
David Knaack
22dc8b842e
feat: add support for elvish shell (#1725)
* feat: add support for elvish shell

* improve doc

* elvish 0.15 is out

* fix example init

* update systax for 0.15 stable

* udpate second init example too

* remove warning from swift module

* add warning to status module docs

* prefix elvish version with v
2021-02-02 12:59:55 +01:00
dependabot-preview[bot]
10d5a7034b build(deps): bump shadow-rs from 0.5.23 to 0.5.24
Bumps [shadow-rs](https://github.com/baoyachi/shadow-rs) from 0.5.23 to 0.5.24.
- [Release notes](https://github.com/baoyachi/shadow-rs/releases)
- [Commits](https://github.com/baoyachi/shadow-rs/compare/0.5.23...0.5.24)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-01 05:39:55 +00:00
Rich Lafferty
3127a9aa87
fix(bash): Count jobs with for loop to fix MacOS count issue (#2250)
In #1897 we replaced a 'wc -l' with a bash-native job counter, but
subsequently discovered that bash on MacOS folds '<<<' output into
a single line, preventing line counting.

A for loop works around that problem, is still bash-native, and works
on Linux as well.

While we're at it, also removed the need for command substitution and
an echo by doing the work directly on NUM_JOBS.

Fixes #2241.
2021-01-31 22:56:06 +01:00
David Knaack
383d2df580
build: add x86_64 freebsd build (#2233) 2021-01-30 12:50:38 +01:00
Furkan Türkal
9e21e3cf5f
feat(vagrant): Add support for Vagrant (#1812)
Signed-off-by: Dentrax <furkan.turkal@hotmail.com>
Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>

Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2021-01-30 12:05:16 +01:00
Matan Kushner
9b02a9742a
chore: update issue template config to correctly use "Q&A" category 2021-01-29 22:03:57 -05:00
David Knaack
6bb79039a3
fix(install): use correct arch name in 32-bit test (#2234) 2021-01-29 16:54:36 -05:00
Matan Kushner
511bd853d6
chore: update Crowdin PR title 2021-01-29 16:53:32 -05:00
Matan Kushner
7df794efa8
ci: continue release on error (#2237) 2021-01-29 16:15:59 -05:00
Matan Kushner
317226b9a7
chore(release): v0.49.0 2021-01-29 12:40:04 -05:00
dependabot-preview[bot]
a267d2da58 build(deps): bump log from 0.4.13 to 0.4.14
Bumps [log](https://github.com/rust-lang/log) from 0.4.13 to 0.4.14.
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/compare/0.4.13...0.4.14)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-27 05:36:41 +00:00
dependabot-preview[bot]
143e4c22b9 build(deps): bump rand from 0.8.2 to 0.8.3
Bumps [rand](https://github.com/rust-random/rand) from 0.8.2 to 0.8.3.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-27 05:28:53 +00:00
Matan Kushner
6afd9ecaf3
docs(i18n): add Vietnamese doc translations 2021-01-26 17:25:25 -05:00
Matan Kushner
bea79619e0
docs(i18n): New Crowdin updates (#2108) 2021-01-26 17:07:13 -05:00
Thomas O'Donnell
762ad12698
test(docker_context): Add basic tests to module (#2205)
* test(docker_context): Add basic tests to module

This adds some basic tests to the docker_context module.

* PR suggestion
2021-01-26 22:46:17 +01:00
Aki
e23f0f7605
docs: update license to include 2021 (#2207) 2021-01-26 22:43:20 +01:00
matoruru
b1efe30bbe
docs(status): fix the format string to match the default (#2211) 2021-01-26 22:42:41 +01:00
David Knaack
857d536488
build: add aarch64 windows build (#2213) 2021-01-26 22:40:48 +01:00
dependabot-preview[bot]
3c31c4b99d build(deps): bump serde from 1.0.122 to 1.0.123
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.122 to 1.0.123.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.122...v1.0.123)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-26 05:37:15 +00:00
dependabot-preview[bot]
f673487638 build(deps): bump sys-info from 0.7.0 to 0.8.0
Bumps [sys-info](https://github.com/FillZpp/sys-info-rs) from 0.7.0 to 0.8.0.
- [Release notes](https://github.com/FillZpp/sys-info-rs/releases)
- [Changelog](https://github.com/FillZpp/sys-info-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/FillZpp/sys-info-rs/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-26 05:30:38 +00:00
dependabot-preview[bot]
a2058b791a build(deps): bump serde from 1.0.120 to 1.0.122
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.120 to 1.0.122.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.120...v1.0.122)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-25 05:59:49 +00:00
dependabot-preview[bot]
70a72c465c build(deps): bump process_control from 3.0.0 to 3.0.1
Bumps [process_control](https://github.com/dylni/process_control) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/dylni/process_control/releases)
- [Commits](https://github.com/dylni/process_control/compare/3.0.0...3.0.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-25 05:49:16 +00:00
dependabot-preview[bot]
9124a5ed72 build(deps): bump git2 from 0.13.16 to 0.13.17
Bumps [git2](https://github.com/rust-lang/git2-rs) from 0.13.16 to 0.13.17.
- [Release notes](https://github.com/rust-lang/git2-rs/releases)
- [Commits](https://github.com/rust-lang/git2-rs/compare/0.13.16...0.13.17)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-25 05:37:27 +00:00
Rodrigo Suárez
ca36d15acd
feat(directory): Add home directory symbol (#2198)
* feat(directory): Add home directory symbol

* Replace HOME_SYMBOL constant as a config variable
2021-01-24 22:50:37 +01:00
David Knaack
b2e8252785
refactor(git_status): simplify git status with once-cell (#2150)
I simplified the code in the git status module by moving everything from RwLock<_> to OnceCell<_>. I think this should also get rid of any remaining race conditions that remained after #1777.
2021-01-24 15:19:22 -05:00
Thomas O'Donnell
a67bf5b34f
docs(terraform): Make version perf issue obvious (#2107)
This intends to make the performance issue with the terraform version
more obvious.
2021-01-23 15:17:51 +01:00
Gautham Warrier
5eacd3abee
perf: use built-in EPOCHREALTIME env-var to compute cmd_duration for ZSH5+ (#1751)
We currently invoke `starship time` in a sub-shell to compute time, which is non-performant. By using $EPOCHREALTIME,
which is an inbuilt env-var in ZSH5, we can get better performance. This commit only targets ZSH5+ and maintains the
old behaviour.
2021-01-23 11:25:41 +01:00
Rust大闸蟹
bcaf835321
build: Add additional build information to version and bug report (#2124)
* fix https://github.com/starship/starship/issues

* cargo fmt

* upgrade shadow-rs 0.5.6

* upgrade shadow-rs

* update

* complet bug_report infomation

* cargo fmt

* upgrade shadow-rs 0.5.11

* upgrade shadow-rs 0.5.14

* fixed:https://github.com/starship/starship/pull/2124#discussion_r559076634
fixed:https://github.com/starship/starship/pull/2124#discussion_r559076918

* add long_version

* upgrade shadow-rs 0.5.19; adaptate clap version() use by shadow-rs clap_version()

* fix unit test error

* fix test error

* upgrade shadow-rs 0.5.22

* upgrade shadow-rs 0.5.23
2021-01-22 20:14:51 +01:00
dependabot-preview[bot]
5471007db9 build(deps): bump rust-ini from 0.16.0 to 0.16.1
Bumps [rust-ini](https://github.com/zonyitoo/rust-ini) from 0.16.0 to 0.16.1.
- [Release notes](https://github.com/zonyitoo/rust-ini/releases)
- [Commits](https://github.com/zonyitoo/rust-ini/compare/v0.16.0...v0.16.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-22 17:33:39 +00:00
Moritz Vetter
4e7f73da50
perf(zig): Lazy eval zig (#2187)
* perf(zig): evaluate version lazily

* fix(zig): update format string; update tests

* refact(zig): remove redundant clone and put everything to do with version eval into match statement

* tiny optimization

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

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2021-01-22 18:08:36 +01:00
Moritz Vetter
212dbc4e6b
perf(ocaml): evaluate version lazily; adjust format string; update test (#2188)
Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-22 18:08:04 +01:00
Moritz Vetter
16b8cbfdb8
perf(perl): Lazy eval perl (#2189)
* perf(perl): evaluate version lazily

* fix(perl): update format string; update tests

* refact(perl): run rustfmt

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-22 18:07:03 +01:00
Moritz Vetter
d10a83ce6b
perf(php): Lazy eval php (#2190)
* perf(php): evaluate version lazily

* fix(php): update format string; update tests

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-22 18:03:18 +01:00
Moritz Vetter
60be1e9540
Perf(purescript): Lazy eval purescript (#2191)
* perf(purescript): evaluate version lazily

* fix(purescript): update format string; update tests

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-22 18:01:54 +01:00
Alexandru Macovei
499e0357b0 refactor: apply more clippy lints 2021-01-22 11:50:12 -05:00
Alexandru Macovei
c8a8086930 refactor: simplify print::handle_module 2021-01-22 11:50:12 -05:00
Alexandru Macovei
3e6b2713b2 refactor: simplify StringFormatter::new 2021-01-22 11:50:12 -05:00
dependabot-preview[bot]
7cb1b7e373 build(deps): bump git2 from 0.13.15 to 0.13.16
Bumps [git2](https://github.com/rust-lang/git2-rs) from 0.13.15 to 0.13.16.
- [Release notes](https://github.com/rust-lang/git2-rs/releases)
- [Commits](https://github.com/rust-lang/git2-rs/compare/0.13.15...0.13.16)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-22 05:28:42 +00:00
David Knaack
132be11790
build: add builds for various targets (#2137)
* build: add builds for various targets

* fix typo

Co-authored-by: Matan Kushner <hello@matchai.me>

Co-authored-by: Matan Kushner <hello@matchai.me>
2021-01-21 23:17:02 +01:00
Moritz Vetter
00afc82049
perf(kotlin): Lazy eval kotlin (#2186)
* perf(kotlin): evaluate version lazily

* fix(kotlin): update format string; update tests

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-21 23:01:30 +01:00
Moritz Vetter
98b89b9432
perf(lua): Lazy eval lua (#2185)
* perf(lua): evaluate version lazily

* fix(lua): update format string

* test(lua): update tests

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-21 23:00:12 +01:00