1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-06-10 04:12:20 +00:00
Commit Graph

39 Commits

Author SHA1 Message Date
David Knaack
aa6c2dd588
chore: fix clippy warnings for rust 1.66 (#4715)
chore: fix new clippy lints
2022-12-17 18:01:27 +01:00
David Knaack
6e38683c89
chore: fix new clippy lints (#4557) 2022-11-05 12:40:46 +01:00
David Knaack
6ac5df904b
refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
David Knaack
ac55a01d0f
feat(git): replace git2 with git-repository (#3883) 2022-08-08 22:33:00 -04:00
David Knaack
bd7957f01c
fix(git_branch): correct variable name for remote branch (#3897) 2022-04-26 20:02:01 +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
IsaacHorvath
bae16b525d
feat(git_branch): add 'ignore_branches' option (#3753)
* git-branch: Add option 'ignore_branches'

* git-branch: add 'ignore_branches' test

* git-branch: comma-separated to toml array

* git-branch: update ignore_branches test

* git_branch: fix formatting

* git-branch: fix formatting again

* Initialize ignore_branches as empty

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

* Use iter().any and branch_name as suggested

* Fix formatting

Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2022-03-16 21:41:49 +01:00
arcnmx
e3a88a6ec1
fix(git_branch): more robust handling of .git (#3290) 2021-12-03 15:15:31 -05:00
David Knaack
77182a9a22
chore(clippy): fix new clippy lints (#3294) 2021-12-03 00:54:56 -06: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
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
Kim Christensen
70b397a1c4
fix(git_branch): Make Git branch module support bare repositories (#2522)
Co-authored-by: Kim Christensen <KMCH@simcorp.com>
2021-04-01 18:51:55 +02:00
David Knaack
ba40ad5ce6
chore(clippy): fix new lints (#2507) 2021-03-25 16:03:19 -04: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
Sagittarius-a
d670212a08
feat(git_branch): show remote name (#1972)
* feat(git_branch): Show remote name in addition to remote branch

* feat(git_branch): Fix table indentation in config README

* feat(git_branch): Use a different method to fetch remote information

* feat(git_branch): Fix the Clippy issue regarding string constant
2020-12-08 11:12:53 +01:00
Sagittarius-a
688f1b3457
feat(git_branch): add remote branch name if different than local branch (#1915)
* feat(git_branch): add remote branch name if different than local branch

* feat(git_branch): Implement a more customizable remote branch

* feat(git_branch): Use more explicit API function name

* feat(git_branch): Remove forgotten draft documentation

* feat(git_branch): Set less verbose defaults

* feat(git_branch): Handle case to always display remote

* feat(git_branch): Fix error in rebase operation
2020-11-23 22:07:16 +01:00
Aaron Gable
4b85b40cb0
feat(git_branch): add 'only_attached' config bool (#1910)
* feat(git_branch): add 'only_attached' config bool

This adds a new boolean, `only_attached`, to the configuration for
the `git_branch` module. This mirrors the `only_detached` config
value for the `git_commit` module: setting the value to true causes
the module to suppress its output when the user is not on a branch.

This allows users to have either a branch name or a commit hash in
their prompt, as opposed to having either a branch name or the
overly-wordy "HEAD (sha1)".

* Fix formatting
2020-11-23 19:22:51 +01: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
ec76fafff0
feat: refactor modules to use format strings (#1374) 2020-07-07 18:45:32 -04:00
Thomas O'Donnell
391add767f
revert: fix(git_branch,git_status): implement fallback branch_n… (#1092)
This reverts commit 8d90baf0eb.
2020-04-11 16:10:39 -04:00
Hendrik Rombach
8d90baf0eb
fix: implement fallback branch_name for bare git repos (#1035)
closes #686
2020-04-07 12:01:40 +02:00
Thomas O'Donnell
e0c90a6502 refactor: Remove to remove unneeded mutability (#577)
Removed a couple of unneeded `mut`s that were pointed out by `cargo
check`.
2019-10-24 19:31:17 +09:00
Matias Kotlik
d2eef11148 refactor: Refactor git_branch module to use new module config (#535) 2019-10-15 20:48:53 +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
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
Titouan Vervack
59e8b1fc92 feat: added truncation_length/symbol to git_branch (#268)
Git branches can become very long (e.g. gitlab auto-generated branch
names), thus it would be nice to be able to truncate them to keep your
prompt lenght in line.

This patch adds two new options to the git_branch module:
* truncation_length: The amount of graphemes to of a gitbranch to
truncate to
* truncation_symbol: The symbol that should be used to indicate that a
branch name was trunctated

To be able to correctly work with UTF-8 graphemes, unicode-segmentation
was added as a dependency.
2019-09-02 15:56:59 -04: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
Matan Kushner
90d6e6cf0b
Implement the git status module (#45) 2019-05-13 22:43:11 -06:00
Matan Kushner
8b5055d510
Parallelize prompt modules (#46) 2019-05-09 23:51:50 -04:00
Matan Kushner
c6ee5c6ac1
Refactor segments into modules (#40) 2019-05-01 16:34:24 -04:00
Matan Kushner
9a352c0acc
Add the Git branch segment (#32)
Added
- Repository to Context for reuse in directory and git_branch
- git_branch to prompt

Changed
- Made segments bold to match spaceship
2019-04-26 22:07:07 -04:00