1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-06-06 18:40:47 +00:00
Commit Graph

487 Commits

Author SHA1 Message Date
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
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
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
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
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
Thomas O'Donnell
5cf1c8a7bd
perf(utils): Add timeout to utils::exec_cmd (#2171)
* perf(utils): Add timeout to `utils::exec_cmd`

This adds a timeout to any command executed using the `utils::exec_cmd`.
The initial time limit is hard coded to 500ms but if required we can
make this configurable. Have also switched the tests to be a bit more
granular on which systems they are ignored.

* Terminate the processes if they timeout
2021-01-21 22:59:14 +01:00
Moritz Vetter
b5fd517972
perf(nodejs): evaluate nodejs format string lazily (#2160)
* fix(nodejs): update format string

* test(nodejs): adjust tests to new format strings

* fix(nodejs): use once_cell's Lazy to implement hassleless lazy execution

* chore(nodejs): run rustfmt

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-20 19:03:48 +01:00
David Knaack
8302a3ccb4
perf(custom): evaluate command lazily (#2173) 2021-01-20 19:01:49 +01:00
David Knaack
bb160d9207
perf(elixir): evaluate version lazily (#2172) 2021-01-20 18:59:21 +01:00
Moritz Vetter
2532251a13
perf(dart): Lazy eval dart (#2166)
* perf(dart): evaluate version lazily

* fix(dart): update format string

* fix: use suggested format string

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-20 18:56:18 +01:00
Moritz Vetter
83e0432a75
perf(java): Lazy eval java (#2168)
* perf(java): evaluate version lazily

* fix(java): update format string

* fix: use suggested format string

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-20 18:51:30 +01:00
Moritz Vetter
b065758b1c
perf(elm): Lazy eval elm (#2167)
* perf(elm): evaluate version lazily

* fix(elm): update format string

* fix: use suggested format string

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-20 18:49:26 +01:00
Moritz Vetter
527ffbaede
fix: Adjust default format strings (#2165)
* fix(dotnet): update dotnet format string

* fix(dotnet): update erlang format string

* fix(dotnet): update golang format string

* fix(dotnet): update helm format string

* fix(dotnet): update julia format string

* fix(dotnet): update nim format string

* fix(dotnet): update ruby format string

* fix(dotnet): update rust format string

* test: update formatted strings in unit tests

* Use suggested format strings

Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2021-01-20 18:46:26 +01:00
Moritz Vetter
e437a463ac
perf(python): Lazy eval of python version command (#2158)
* perf(python): evaluate version lazily

* fix(python): update format string

* fix: use suggested format strings

Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2021-01-20 18:42:55 +01:00
David Knaack
d3002cf961
test: avoid setting $HOME (#2155)
* test: avoid setting $HOME

* add comment to get_home

* move everything to context.get_home
2021-01-19 23:23:27 +01:00
Moritz Vetter
2391a2863c
perf: evaluate swift version lazily (#2159)
* perf(swift): evaluate version lazily

* fix(swift): update format string

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-18 22:42:28 -06:00
Thomas O'Donnell
12494da38a
fix(cmake): Fix spacing with missing variable (#2135)
This fixes the additional space when the `version` variable can't be
populated.
2021-01-16 13:27:02 +01:00
Hanif Ariffin
5722b17f9e
fix: Applied clippy warnings (#2153)
* Applied changes suggested by clippy

In general:

1. Prefer std::path::Path over std::path::PathBuf
2. Simplified code with string formating...

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>

* Fixed test

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>

* Fixed formatting

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2021-01-16 13:26:52 +01:00
David Knaack
fb0381f7e0
test: enable logging in tests (#2151)
* test: enable logging in tests

* fix clippy
2021-01-16 13:25:58 +01:00
Thomas O'Donnell
f640db87a4
perf(crystal): Lazily evaluate version command (#2129)
* perf(crystal): Lazily evaluate version command

This updates the module to lazily execute the `crystal --version`
command only when the `version` variable is used in the format string.

* perf(crystal): Update format string

Update format string to handle the `$version` variable not being set.
2021-01-13 18:35:44 +01:00
Ben Iofel
0a9db856de
fix(docker_context): enable if either yml or yaml is found (#2053)
* fix(docker_context): enable if either yml or yaml is found

* Update docs
2021-01-11 17:38:58 +01:00
Kevin Song
3fc9f490bb
docs: Comment about spaces in nix-shell config (#2106)
* Add comment about doublespace in nix-shell config

* docs: Add a semantic PR commit to appease the bot
2021-01-09 10:29:47 +01:00
Zoritle
851cf22caa
feat: Add support for cygwin/msys2/git-bash evironment (#2020)
* feat: Add support for cygwin/msys2/git-bash evironment

* Update src/init/mod.rs

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

Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2021-01-07 19:13:57 +01:00
Furkan Türkal
f03c3f1de9
feat(command): add 'toggle' command (#1917)
Closes #894

Signed-off-by: Dentrax <furkan.turkal@hotmail.com>
2021-01-07 19:04:06 +01:00
Thomas O'Donnell
8cd4850ab6
fix(bash): Fix broken bash init script (#2100)
This fixes a regression where the exit code of the most recently run
command was not correctly recorded in the bash init script.
2021-01-07 18:35:32 +01:00
David Knaack
452694903c
fix(pwsh): disable builtin venv prompt (#2090) 2021-01-07 18:16:02 +01:00
Kevin Song
55c3cafd94
fix(bash): bash-preexec detection and implementation (#2091)
* Fix bash-preexec detection and implementation

* Add detection for other arrays
2021-01-07 18:15:43 +01:00
Glandos
2e71dfa15b
perf(init): Use random for session-key in fish (#1904)
* perf(init): Use random for session-key in fish

Same as #1755 but for fish users

* Update src/init/starship.fish
2021-01-04 18:36:50 +01:00
Hugues Morisset
cfff77043e
feat(status): Convert known status code to their meaning (#1948)
User is able to choose if their want to display the meaning of known status code in place of number.
2021-01-02 21:09:13 -06:00
Thomas O'Donnell
1ba862b26f
style: Latest clippy suggestions (#2048)
Have fixed a few new suggestions from the latest version of clippy.
2021-01-01 12:45:04 -06:00
David Knaack
6de4bb01f4
feat(battery): make module behaviour more obvious (#1950) 2021-01-01 12:16:55 +01:00
Nicola Corti
208251adef
feat(kotlin): Add the kotlin module (#2026)
Add a module to show the currently installed Kotlin version if a
.kt/.kts file is found in the current folder
2020-12-26 15:26:50 +01:00
Thomas O'Donnell
53a08712eb
fix(user): Fix username detection on Windows (#2014)
* fix(user): Fix username detection on Windows

This switches Windows to use the env var `USERNAME` rather than `USER`
for getting the username of the current user. I have also done some minor
refactoring to simplify some of the code and make the checks to see if
the user is root or another user a bit more robust.

* Update src/modules/username.rs

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

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2020-12-26 13:27:10 +01:00
dependabot-preview[bot]
df5a7994c6
build(deps): bump rand from 0.7.3 to 0.8.0 (#2016) 2020-12-25 18:08:07 +00:00
Thomas O'Donnell
85de6dfe50
feat(utils): Support non-exe commands on Windows (#2019)
Have added support to the `utils::exec_cmd` to allow it to execute
commands that are not `.exe` on Windows. Have also added a timer to
measure how long a command took to execute.
2020-12-22 17:44:38 +01:00
花蛄
4f51ef8db1
feat(package): Meson package support (#2001)
* Add package version support for Meson meson.build.

* Update docs with Meson package version support.
2020-12-19 14:17:34 +01:00
Bjørn Forsman
f17556d389
feat(init): prefix STATUS and PREEXEC_READY shell vars with STARSHIP_ (#1710)
I was surprised to see these (unprefixed) variables being set in my
shell. I think it's better to have them in the STARSHIP_ "namespace".
(Actually, STATUS got the new name STARSHIP_CMD_STATUS.)
2020-12-19 12:04:15 +01:00
Alexandru Macovei
94b74acc90
refactor: a few low-hanging optimizations (#1992)
* refactor: convert some vecs to static arrays and slices

* refactor(openstack): lazy yaml file reading, skip files without expected structure, and avoid panics for some edge cases
2020-12-16 17:54:21 +01:00
Daniel Beckwith
1296632ff4
feat(shlvl): Add repeat option (#1995) 2020-12-14 15:40:21 -05:00
David Knaack
60be453797
fix(config): log as error if failure to read config wasn't caused by NotFound (#1993) 2020-12-13 16:24:48 +01:00