1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-12-01 01:04:00 +00:00
starship/src
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
..
configs feat(localip): add module to print the current ipv4 address (#3289) 2022-01-30 21:31:26 +01:00
formatter fix(escaping): move escaping to individual variables (#3107) 2021-11-01 22:18:45 +01:00
init refactor(zsh): using add-zsh-hook instead of add hook manually (#3537) 2022-02-05 22:37:34 -08:00
modules fix(status): Enable to convert from i64 to hex_status by casting instead of parsing status. (#3462) 2022-02-05 21:13:42 +01:00
test fix(status): Enable to convert from i64 to hex_status by casting instead of parsing status. (#3462) 2022-02-05 21:13:42 +01:00
bug_report.rs fix: Correctly detect older versions of powershell in bug-report (#3543) 2022-02-03 21:51:39 +01:00
config.rs feat(cmd_duration): Make notification timeout configurable (#3515) 2022-01-29 22:56:55 +01:00
configure.rs refactor: update clap to v3 (#3370) 2022-01-04 12:49:42 +03:00
context.rs fix(status): Enable to convert from i64 to hex_status by casting instead of parsing status. (#3462) 2022-02-05 21:13:42 +01:00
lib.rs fix(windows): avoid inadvertly running exes from cwd (#2885) 2021-07-16 15:20:59 -04:00
logger.rs fix(clippy): fix new clippy lints (#2939) 2021-07-29 14:27:46 -04:00
main.rs feat(cli): Print arguments if argument parsing fails (#3560) 2022-02-06 23:04:28 +01:00
module.rs feat(localip): add module to print the current ipv4 address (#3289) 2022-01-30 21:31:26 +01:00
print.rs refactor: update clap to v3 (#3370) 2022-01-04 12:49:42 +03:00
segment.rs feat: Add a fill module to pad out the line (#3029) 2021-09-12 19:59:15 -04:00
utils.rs feat: add a container indicator (#3304) 2022-01-21 09:44:46 -06:00