1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-09-28 21:19:10 +00:00
Commit Graph

40 Commits

Author SHA1 Message Date
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
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
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
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
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
Kevin Song
0d3b2aaf12
style: Add comments for bash preexec fix (#1952)
* Add comments for bash fix

* Rewrite commend
2020-12-02 08:48:13 +01:00
Harald Hoyer
f873a9820e
fix(bash): Fix background jobs with z/autojump (#1897)
Fixes issue where having z.sh or autojump hooked in bash
would cause spurious background job indicators to appear.
2020-12-02 00:29:02 -06:00
David Knaack
a05be18447
fix(pwsh): fix crash on error in shell with old pwsh (#1861)
Handle missing Get-Error in powershell gracefully.
2020-11-12 10:42:03 -06:00
David Knaack
35a0a20f5c
perf(init/pwsh): use get-random for session-key instead of invoking starship session (#1860) 2020-11-08 11:07:25 +01:00
Gautham Warrier
7450510327
perf(init): use $RANDOM env-var instead of starship session to generate session-key (#1755) 2020-11-07 16:30:08 +01:00
Gautham Warrier
f0cc2bea79
fix(zsh): Ensure existing keymap change functions are not overriden (#1826) 2020-10-27 19:01:52 +01:00
marcos-quezada
745a554fdc
fix(pwsh): Switched pwsh profile to use dollar hook for a more accurate success/failure handling (#1745)
* [f]Use_global_dollar_hook_for_lastExitCodeForPrompt Switched to use the dollar hook, as source of truth for exit code of las command, included comments to clarify.

* fix: Adjusted accordingly to comments on PR.

* fix: Moved last exit code handling inside  if to reuse that variable.

Co-authored-by: Marcos Quezada Perez <marcos.quezadaperez@peakwork.com>
2020-10-24 11:18:58 +02:00
David Knaack
daf7976f9d
fix(pwsh): preserve original console encondings (#1810) 2020-10-19 13:52:15 -04:00
Tilmann Meyer
2650dc8f3f
fix(powershell): fix session key syntax error (#1697) 2020-09-30 12:14:10 -04:00
Tilmann Meyer
2233683410
feat: add error messaging (#1576)
This creates a custom logger for the log crate which logs everything to a file (/tmp/starship/session_$STARSHIP_SESSION_KEY.log) and it logs everything above Warn to stderr, but only if the log file does not contain the line that should be logged resulting in an error or warning to be only logged at the first starship invocation after opening the shell.
2020-09-28 16:38:50 -04:00
David Knaack
6186e296ac
fix(zsh): work when setopt ksh_arrays is set (#1612) 2020-09-14 08:30:57 +02:00
Joshua Poehls
2996220568
fix(pwsh): update init script to propagate $LASTEXITCODE and $?
Previously the prompt function used in PowerShell would overwrite the $LASTEXITCODE and $? automatic variables that were set by the previous command run the user in the shell. This results in surprising behavior for the user if they inspect those variables looking for the result of the command they last ran.

This fixes the bug reported here: https://github.com/starship/starship/issues/1051
And goes further to also propagate the $? automatic variable which is not mentioned in that bug.
2020-09-09 11:52:30 -04:00
David Knaack
d4515696a4
fix(pwsh): stop paths from being interpreted as patterns (#1569)
Convert-Path in the powershell prompt script works with -Path,
which interprets paths as wildcard patterns.  

Not all valid paths are also valid wildcard patterns, possibly causing
the prompt to error (eg []*).  

Replace it with -LiteralPath that makes Convert-Path use the path as-is.
2020-08-19 23:45:10 -05:00
Jason Wang
14f7cd461c
fix(bash): init breaks if PROMPT_COMMAND includes starship_precmd as an intermediate command (#1541) 2020-08-03 22:05:31 +02:00
Munif Tanjim
525dfef9a7
fix(bash): last command status and command duration (#1185)
* fix: character module last command status for bash

* fix: command duration module for bash
2020-06-10 18:53:56 +02:00
Nemo157
fb121cd62a
fix: Retain previous command state on zsh keymap select (#958) 2020-06-09 18:52:29 +02:00
Dario Vladović
cf87ce5f50
style(init): tidy-up init scripts (#1269)
* style: fix indent & spacing

* chore: use consistent function definition style

* chore: remove extra semicolon

* chore: flip comparison expression
2020-05-28 12:21:36 -04:00
Jean Gautier
02edad0c66
fix(directory): avoid confusing modules with PowerShell paths (#1114)
* Avoid confusing modules with PowerShell paths

* Avoid confusing modules with PowerShell paths

Powershell supports PSDrives (https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-psdrive?view=powershell-7) that allow to create "logical" drives mapped to actual Windows drives.

* Preserve Windows directories

* Preserve logical paths for Powershell

* Fix formating with cargo fmt

* Fix directory_in_root test

Co-authored-by: Jean Gautier <jean.gautier@ssi.gouv.fr>
2020-04-30 10:40:56 +02:00
Jon Grythe Stødle
2509a79176
fix: Change command duration variable for Ion shell to CMD_DURATION (#911) 2020-02-06 14:41:55 -05:00
InNoobWeTrust
2eeaa05bfb feat: Terminate $PROMPT_COMMAND properly (#799)
Add trailing semicolon to end $PROMPT_COMMAND properly.
This will prevent starship_precmd to accidentally mess with other hooks invoked after it.
2020-01-04 10:52:08 -05:00
InNoobWeTrust
9d49410102 fix: Remove trailing semicolon from $PROMPT_COMMAND (#784)
Remove any trailing semicolon in $PROMPT_COMMAND before appending starship_precmd, to prevent syntax error.
2019-12-28 10:03:59 -05:00
Luca Rinaldi
6a2b0a67b0 feat: cmd_duration module optionally reports milliseconds (#696) 2019-12-19 17:38:06 -05:00
Etienne Mabille
879649d542 fix(bash): save and restore "$_" (#753) 2019-12-19 16:20:44 -05:00
David Knaack
b2ebd24506 fix(powershell): Fix prompt not updating on -nix systems (#728)
Closes #661
2019-12-13 13:44:58 -05:00
BuggStream
93701b26b3 feat: Add support for the ion shell (#704) 2019-12-11 15:31:30 -05:00
Matias Kotlik
221f07548c fix: Disable venv custom prompt when starship is in use (#551) 2019-10-25 21:41:00 +09:00
David Knaack
6ab70796db feat: Implement PowerShell support (#470) 2019-10-16 00:10:16 +09:00
Matan Kushner
05210b9510
refactor: Go from Rust workspaces to a package with nested packages (#480) 2019-10-04 22:30:46 +09:00
Zhenhui Xie
dd0b1a1aa2 refactor: Refactoring config (#383)
This PR refactors config and puts configuration files for all modules in `configs/`.
2019-09-30 21:10:35 +09:00
Matan Kushner
caaf3bc6a9
revert: Revert the command duration in ms feature (#380) (#425)
Due to incompatibilities with the macOS date utility, we are
temporarily reverting this feature.

Refs: #c5e971a
2019-09-25 17:13:58 +09:00
Tom Hotston
c5e971aef8 feat: Add ability for command duration in milliseconds (#380) 2019-09-24 14:03:10 -05:00
Kevin Song
54793c7d5a refactor: Separate shell initialization into files (#338)
Shell inits are now in a separate directory in the source code, with each shell getting its own script. Also adds a little DRY + commenting in init/mod.rs.
2019-09-10 20:31:08 -04:00