Commit Graph

17 Commits

Author SHA1 Message Date
Dom Slee ce7f984932
fix(config): Make print-config not panic without a config (#5001) 2023-04-13 19:29:21 -05:00
David Knaack 2d4b183fce
refactor: replace module_config_derive with serde (#3786)
* refactor: replace module_config_derive with serde

Changes include:
* Removing `starship_module_config_derive` and replacing it with `serde::Deserialize`
* Removing `RootModuleConfig::load_config`. While potentially useful, it was only used in tests. And it would require something like `serde::DeserializeSeed` which is not derived by serde.
* Merging `RootModuleConfig` into `ModuleConfig`
* Implementing a `ValueDeserializer` that holds a reference to a `toml::Value` in `serde_utils.rs`
* Deserialization errors (invalid type) are now logged and include the current key and the struct names
* Unknown keys are now considered an error. "Did you mean?"-messages are still possible

* fix typo

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

Co-authored-by: Matan Kushner <hello@matchai.dev>
2022-03-26 10:42:19 +01:00
David Knaack 1745392909
refactor: fix new clippy/compiler warnings (#3656) 2022-02-24 23:31:01 -05:00
David Knaack 1eaf996a36
fix(windows): avoid inadvertly running exes from cwd (#2885)
On Windows when running commands with their name instead of the path with Command::new, executable with that name from the current working directory will be executed.

This PR replaces all instances of Command::new with a new create_command function which will first resolve any executable paths and avoid this issue.
2021-07-16 15:20:59 -04: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
jRimbault 95bb901b8a
chore: fix the double compiling of lib and bin (#1616)
* fix: rust modules are compiled twice

The modules being declared both in the _library_ crate and the _binary_
crate made cargo compile everything twice:

1. for the library
2. for the binary

What happened was:

1. The library "starship" was compiled.
2. The binary "starship" (and all its modules) were compiled.

* fix: stop compiling every rust module twice

restrict visibility

* Run cargo fmt

* Add bug_report module

Co-authored-by: Matan Kushner <hello@matchai.dev>
Co-authored-by: Kevin Song <chips@ksong.dev>
2020-10-17 11:09:27 +02: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
Tilmann Meyer 88b603be38
test: introduce env variable mocking (#1490) 2020-08-07 15:13:12 -04:00
Zhenhui Xie 22dc419a3e
improvement: add parser for format strings (#1021)
This PR implements the parser of format strings described in #624.
2020-04-06 13:16:18 -04: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 097f1b05f1
Add support for prompt configuration (#62)
- Create `Config` struct that is added to `Context` when initialized
- Read `~/.confg/starship.toml` during initialization (can be updated later to also look at `$XDG_CONFIG_HOME`)
- `Context` now has a method for creating modules. This allows us to provide modules with a reference to the configuration specific to that module
2019-06-10 15:56:17 +01:00
Matan Kushner c6ee5c6ac1
Refactor segments into modules (#40) 2019-05-01 16:34:24 -04:00
Matan Kushner 022e0002e4
Use "context" to contain run details (#14)
* Create "context" to contain run details

* Use context in tests and benchmarks
2019-04-19 16:57:14 -04:00
Matan Kushner d82ebc4457
Add builder pattern for segment 2019-04-12 17:49:20 -04:00
Matan Kushner ff94c9f25f
Use git project root for truncation 2019-04-07 16:43:11 -04:00
Matan Kushner 52a529c627
Add basic benchmarks 2019-04-04 16:59:03 -04:00