1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-06-02 08:30:50 +00:00
Commit Graph

29 Commits

Author SHA1 Message Date
Rashil Gandhi
c89c13038a
feat(username): Detect Admin access in Windows (#2791)
* Detect Admin access in Windows

* Update username doc

* Do not run tests when elevated

* Add comment

* Try fixing tests

* use deelevate crate

* simplify cfg

* Update src/modules/username.rs

Fix rookie mistake

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

* handle errors

* fix lockfile error

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2022-04-01 17:47:49 +02: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
Fred Cox
c1f2d345aa
fix(escaping): move escaping to individual variables (#3107) 2021-11-01 22:18:45 +01:00
David Knaack
af43aeefba
fix(clippy): fix new clippy lints (#2939) 2021-07-29 14:27:46 -04:00
David Knaack
436eb61efd
test: allow running tests as root (#2571) 2021-04-10 19:05:46 +02:00
Dario Vladović
404b4f3d0c
refactor(username): reformat code to match docs (#2517) 2021-03-27 22:13:20 +01:00
David Knaack
04d1332f9c
refactor(clippy): fix new lints (#2297) 2021-02-11 21:08:17 +01:00
David Knaack
e8a02e7d53
perf(username): get uid without external command (#2286) 2021-02-09 18:41:09 +01: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
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
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
yangsheng6810
a72977f7d4
feat(username): Try harder to guess if inside ssh (#1964)
* feat: Try harder to guess if inside ssh

* Add test for SSH_CLIENT

* Update documentation on checking ssh connection

* Update docs/config/README.md

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

Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2020-12-06 22:15:20 +01:00
Matan Kushner
d3100c5c82
fix: use suffixes for modules before directory (#1645)
Previously, all modules would have prefixes, which lead to the first
module having a dangling prefix. This change ensures that the first
few modules would instead have suffixes so that we don't start or
end with a prefix or suffix.
2020-09-08 12:09:21 -04:00
Tilmann Meyer
88b603be38
test: introduce env variable mocking (#1490) 2020-08-07 15:13:12 -04:00
Zhenhui Xie
ec76fafff0
feat: refactor modules to use format strings (#1374) 2020-07-07 18:45:32 -04:00
Thomas O'Donnell
edc62f4518 refactor: Refactor modules to use the exec_cmd util (#676)
Have refactored the golang, java, nodejs, python, ruby and username
modules to use the new `exec_cmd` util.
2019-12-02 17:42:55 -05:00
Zhenhui Xie
aadd8ecf2c refactor: Refactor modules to use module config (#514) 2019-10-19 10:51:38 +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
Gimbar
702ad274cf feat: Add option to always show the username module (#408) 2019-09-22 15:32:11 -05:00
Neil Kistner
9f70ffb7a7 fix: Lazy load git repo and only run module if not disabled (#306)
A couple of optimizations are done in this PR. One, we now will check config ahead of time to see if a module is disabled before running any module code. Also, we won't try to discover a git repository unless the module requests access to it.
2019-09-09 19:14:38 -04:00
Kevin Song
9721666d33
feat: Add the ability to configure per-module color styles (#285)
Add parsing logic, config support, docs, and integration with other modules 
for custom styling of each module.
2019-09-07 19:33:06 -05:00
Saghm Rossi
dfe2ae643a fix a few typos (#178) 2019-08-17 20:50:42 -07:00
Matan Kushner
f40f73dc8e fix: Address longstanding linter errors 2019-08-05 11:05:08 -04:00
Tiffany Le-Nguyen
08cf33522a docs: Add vuepress with initial docs (#99)
Co-authored-by: Tiffany Le-Nguyen <tlenguyen@expedia.com>
Co-authored-by: Matan Kushner <hello@matchai.me>
2019-07-19 16:18:52 -04:00
Matan Kushner
77ba97df19
chore: Refactor getting string values from config (#94) 2019-07-14 11:15:47 -04:00
Matan Kushner
463ec26024
feat: Add a disabled configuration option for modules (#86)
• Add support for the disabled configuration option
This will allow you to selectively disable modules that you don't want or need. 😄
• Overwrite starship configuration file path with STARSHIP_CONFIG environment variable
• Write tests for the two configuration options that are available
2019-07-02 16:12:53 -04: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
Youssef Habri
08b238114e feat: Implement the prompt module for username (#56) 2019-05-19 22:26:12 -04:00