1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-10 15:20:55 +00:00
Commit Graph

244 Commits

Author SHA1 Message Date
Zhenhui Xie
5bb7467b56 refactor: Cleanup after module config refactor (#630) 2019-11-07 12:38:30 +09:00
Zhenhui Xie
a3d5ea3e43 refactor: Refactor git state module to use module config (#605) 2019-11-06 22:00:31 +09:00
Zhenhui Xie
48726fdd2a refactor: Refactor nix_shell and java module to use module config (#606) 2019-11-06 21:59:12 +09:00
Thomas O'Donnell
42f6868e3f feat: Enable the python module in virtual envs (#584)
This will enable the python module when a virtual environment has been
activated, this is detected via the `VIRTUAL_ENV` env var.
2019-11-02 20:10:21 +09:00
Cédric Da Fonseca
fa1267f12f feat: Add configuration to set how much AWS profile info is shown (#556) 2019-11-02 20:08:54 +09:00
Matias Kotlik
e01c41eddf style: Clean up Golang module (#612) 2019-11-01 10:53:28 +09:00
Zhenhui Xie
fed1341e22 feat: Add an option to limit the duration of starship directory scanning (#589) 2019-10-28 22:41:16 +09:00
Brian Low
2710d02709 feat: Show git_status counts (#434)
The git_status module can show the count of files next to their respective symbols.
2019-10-26 15:20:20 +09:00
Matias Kotlik
221f07548c fix: Disable venv custom prompt when starship is in use (#551) 2019-10-25 21:41:00 +09:00
Zhenhui Xie
321e440289 chore: Move StarshipRootConfig to a separate file (#581) 2019-10-25 10:08:09 +09:00
yuri
b7762a3e91 fix: Show Java version from OpenJ9 Java runtimes (#507)
This PR tries to improve the version detection across multiple Java VM vendors. The module captures both STDOUT and STDERR outputs of the java -Xinternalversion call.

Eclipse OpenJ9, Azul Zulu, SapMachine, Amazon Corretto and GraalVM outputs are unit tested now.
2019-10-25 10:00:05 +09:00
Zhenhui Xie
aa260899d4 fix: Use logical path instead of physical path when available (#398)
* Get pathbuf from logical path. (fixes #204)

(also fixes #397)

* fix: Update directory module so that use_logical_path will work properly

* Remove test directory::use_logical_and_physical_paths

* Fix merge errors


Co-authored-by: Matan Kushner <hello@matchai.me>
2019-10-24 19:37:44 +09: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
86bb923303 refactor: Refactor memory_usage module to use module config. (#515)
Also addresses a number of bugs:
- the percent sign not displaying correctly on some terminal emulators, including kitty
- changing the symbol in the configuration file didn't do anything
- swap being shown even if the system didn't have any
2019-10-21 00:26:04 +09:00
Thomas O'Donnell
7b9197a67e fix: Fix the python module ignoring error codes (#563)
This is a quick fix to stop the python module from displaying error
messages that have been printed to stderr as the version.
2019-10-20 17:42:27 +09:00
Clément Joly
7e21f5c6b6 Refactor: Remove unnecessary parentheses in if condition (#566) 2019-10-20 17:36:02 +09:00
Barnaby Keene
2c7e01cd62 refactor: improve as-a-library usage by removing ArgMatches depe… (#547)
This removes ArgMatches from the Context struct and replaces it with a simple HashMap. This work is towards getting Starship in a better place for use as a library in other shells written in Rust so they don't need to use a command-line interface to invoke and configure things.

Contributes to #521
2019-10-20 17:26:27 +09:00
Zhenhui Xie
aadd8ecf2c refactor: Refactor modules to use module config (#514) 2019-10-19 10:51:38 +09:00
Nguyễn Hồng Quân
27fad02837 fix: Separate Python version string and env name (#548) 2019-10-17 18:55:48 +09:00
David Knaack
6ab70796db feat: Implement PowerShell support (#470) 2019-10-16 00:10:16 +09:00
Matias Kotlik
d2eef11148 refactor: Refactor git_branch module to use new module config (#535) 2019-10-15 20:48:53 +09:00
Zhenhui Xie
be2d5cf1cd refactor: Rewrite cmd_duration, directory and env_var module to use module config (#460)
This PR is a batched rewrite of the following modules:
- cmd_duration
- directory
- env_var
2019-10-15 20:34:48 +09:00
Zach Mertes
5303fd7684 feat: Add configuration for hostname truncation (#485) 2019-10-15 01:22:25 +09:00
Keith Wade
10efe3e320 fix: Show leading slash when truncating from root (#526) 2019-10-15 00:12:43 +09:00
Thomas Lee
b3275d8ddf feat: Show AWS region in aws module (#482) 2019-10-15 00:05:03 +09:00
Thomas O'Donnell
a18408e30c fix: Fix the spacing around the AWS default symbol (#529)
This updates the default AWS default symbol to include a space after the
symbol to make it a little bit more readable. Have also updated the
README to include the AWS module.
2019-10-14 22:56:16 +09:00
Thomas O'Donnell
cc68dec795 refactor: Refactor Go module to the new module config (#525) 2019-10-13 13:16:56 +09:00
Zhenhui Xie
57b38f17bb refactor: Rewrite hostname, jobs and line_break module to use mo… (#462) 2019-10-10 17:21:52 +09:00
Keith Wade
9d48706360 feat: Implement timezone offset config option for the time module (#463)
This allows users to configure the time module to display time with a timezone offset other than just their local timezone.
2019-10-10 13:42:57 +09:00
Barnaby Keene
9f365f84d1 refactor: Allow starship to be better used programmatically (#509)
Structure the prompt as a function that returns a string instead of writing directly to stdout.

This makes it easier to embed Starship into other Rust programs such as shells written in Rust. It also decouples the arguments from the context for more programmatic initialization of the context.
2019-10-09 10:43:28 +09:00
Maarten Mulders
8058b51273 feat: Show Java module when build.sbt is present (#505)
* feat: Show Java icon and info when build.sbt detected

* docs: Mention build.sbt detection
2019-10-07 19:18:01 +09:00
(´⌣`ʃƪ)
77c25b60c2 fix: Don't print the first module prefix after a line-break (#473) 2019-10-07 00:46:46 +09:00
Nikodem Rabuliński
06ba22eb5c refactor: Implement Default for SegmentConfig (#495)
Implements the Default trait for SegmentConfig to clean up construction of empty segments.

Also adds a segment::new() function to ease construction of simple segments.
2019-10-05 20:46:14 -05:00
Zhenhui Xie
044e10de1b chore: Import shared types from super (#492)
Changes imports statements to make imports more uniform.
2019-10-05 16:13:03 -05:00
AppleTheGolden
7657af0680 feat: Add conda module (#469) 2019-10-05 13:25:25 -05:00
Thomas Lee
27e8c8f3eb refactor: Rewrite time module to use module config (#483)
- Config option renamed: `12hr` → `use_12hr`
2019-10-06 00:07:00 +09:00
Zhenhui Xie
bc9e44f45c fix: Add disable configuration option to kubernetes module (#491) 2019-10-05 23:10:16 +09:00
Matan Kushner
f2e20bbea2
revert: chore: Remove logic for the disabled option from modul… (#489)
This reverts commit 6c6e0ef1dd.
2019-10-05 19:03:48 +09:00
Thomas O'Donnell
5a8777ff45 fix: Disable Kubernetes module by default (#488)
Given the global nature of the Kubernetes module, the module has been disabled by default. The opportunity has also been taken to refactor the Kubernetes module to use the new config module.
2019-10-05 18:31:23 +09:00
Zhenhui Xie
bedf264a9f fix: Fix module configuration loading (#487) 2019-10-05 18:21:48 +09:00
Zhenhui Xie
6c6e0ef1dd chore: Remove logic for the disabled option from modules (#486) 2019-10-05 18:07:33 +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
9e9eb6a8ef
fix: Disable memory_usage by default (#451) 2019-09-30 16:04:49 +09:00
Tom Hotston
7588137b09 feat: Added ability for setting command duration prefix (#414) 2019-09-30 14:26:32 +09:00
Zhenhui Xie
61604a4a8e feat: Allow segment-specific styling (#378)
Adds the ability to style individual segments in the prompt.

The segment documentation is not fully updated in this commit and is waiting on
a config refactor so that we can write unified docs.
2019-09-29 23:03:07 -05:00
Ryo Yamashita
b7dc6c5e96 fix: Prevent rust module from installing toolchains (#426)
Prevents the rust module from installing rustup toolchains.

Previously, the rust module would trigger rustup toolchain installations in some cases,
leading to frozen prompts while rustup downloads/installs components. This commit
changes the behaviour to avoid this.
2019-09-29 21:39:48 -05:00
Andrew Houts
0eafb2bde7 feat: add memory usage module (#403)
Adds a module to display system memory and swap usage.
2019-09-29 00:55:48 -05:00
yuri
63a45d01f9 feat: Use tilde for home_directory when under version control (#439) 2019-09-28 22:50:38 -05:00
yuri
d3fc66c0c5 feat: Add Environment Variable module (#409) 2019-09-26 17:30:58 +09:00
Thomas O'Donnell
b050c59708 feat: Add AWS module (#419)
Adds a module for displaying the current AWS profile based 
on the AWS_PROFILE envar.
2019-09-25 21:55:47 -05:00
Bijan Chokoufe Nejad
34112ef7a9 refactor: Refactor config.rs to pure functional style (#427)
- Replaced for loop that iterates over mutable state with a fold expression
- Unified the logging for the different accessors. The code is now screaming for further refactoring (get_module_config, get_as_bool, get_as_str, get_as_i64 and get_as_array are basically the same up to higher order functions but I didn't manage to get the life times right)
- Increased test coverage (especially a test case for none not at the end)
- Removed code comments that literally repeated the code in the next line (see e.g. https://blog.usejournal.com/stop-writing-code-comments-28fef5272752)
- Added TODO for the problematic line that swallows the None and produces Some(Style::new()) (this also happened before but in a less obvious way)
2019-09-26 10:38:36 +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
Gimbar
702ad274cf feat: Add option to always show the username module (#408) 2019-09-22 15:32:11 -05:00
Thomas O'Donnell
08340328dd refactor: Remove dead code in battery module (#405) 2019-09-21 09:41:15 -05:00
谢祯晖
14fe246138 fix: Add display for unknown battery state (#316) 2019-09-20 12:52:54 -04:00
Kevin Song
c2875d99b6 feat: add support for logical paths in directory (#366)
Adds the ability for starship to display the logical path instead of the physical path.
2019-09-20 12:28:09 -04:00
Neil Kistner
cd892ebb60 fix: fish_pwd option handles repeated directories properly (#399) 2019-09-20 10:37:55 -04:00
Kuba Clark
71f03ec3e9 feat: Add Java Module (#314)
Implements a Java module which shows basic Java information when inside a Java project.
2019-09-19 18:02:53 -05:00
Neil Kistner
aa26c5bca4 fix: Update Module::is_empty to check value of segments (#332)
Previously, a set of empty segments would cause the module to print. This changes the 
logic of Module::is_empty to check that all the segments are empty instead.
2019-09-16 00:03:44 -05:00
Kutsuzawa Ryo
7a98ec1d8e feat: Add configuration for the git_status prefix and suffix (#367) 2019-09-15 16:44:53 -04:00
Thomas O'Donnell
653def05f0 Enable the python module for tox files (#369)
Enable the python module if the current directory contains a `tox.ini`
file.
2019-09-15 12:21:40 -04:00
Nick Young
7e891f17c1 perf: Lazy load files from directory (#335)
Changes context to use `once_cell` to lazily evaluate directory listing on first use.
2019-09-14 09:23:53 -05:00
Matan Kushner
3e23a9a73c chore: Rename integration_test to acceptance_test (#356) 2019-09-12 18:01:13 -05:00
Rob Warner
373493be85 feat: Add support for italic styles (#354) (#358) 2019-09-12 16:10:42 -05:00
谢祯晖
a6c64e8457 feat: Implement threshold based styling for battery module (#318) 2019-09-12 14:06:59 -04:00
谢祯晖
37b5168bfe fix: Fixups for #138 (#343)
- Fix unused imports in unit tests
- Add accidently remove module "battery"
2019-09-11 08:43:40 -04: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
Daniel Illi-Zuberbühler
ee20d6b2ac fix: Prepend to PROMPT_COMMAND in Bash init (#336)
Bash init: do not overwrite PROMPT_COMMAND but prepend to it.
2019-09-10 15:12:29 -04:00
John Letey
f9a4514045 feat: Implement the prompt module for time (#138)
Add a module which displays the current time in a format requested by
the user. Disabled by default.
2019-09-10 12:54:40 -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
Gabriel de Perthuis
69ebab46a4 fix: Don't trigger an extension match on hidden files (#299)
Addresses #52, closes #280.
2019-09-07 11:05:25 -04:00
Nick Young
eb724279da feat: Adds Git State module for showing "REBASING 2/3", etc. (#276)
- Adds the git_state module.
- Adds git_state to the default prompt order
- Updates the documentation to describe the git_state module
2019-09-05 12:45:04 -04:00
Thomas O'Donnell
4f17bae315 fix: Add missing module to list of modules (#294)
Have added the missing hostname module to the list of all modules.
2019-09-05 11:33:24 -04:00
Neil Kistner
1c66869117 feat: Add config for ahead/behind count of tracked branch (#281)
Add a configuration option (show_sync_count) to the git_status module that will show/hide the counts ahead/behind of the tracked branch. Currently have this default to false, and would opt-in to show this information.
2019-09-05 00:09:51 -04:00
Matan Kushner
e66d7bae1c
ci: Migrate CI from Azure Pipelines to GitHub Actions (#233)
Migrated CI from Azure Pipelines to GitHub Actions.
Until the release process is figured out in Actions, we'll stick to using Azure pipelines for releases.
2019-09-04 19:13:53 -04:00
Andrew Houts
84688e4981 feat: add hostname module (#286)
Add a hostname module as requested by @chipbuster.
Displays the system hostname as provided by gethostname.
2019-09-04 13:03:31 -04:00
Nick Young
5a0f269d85 fix: Be more restrictive with bash init fallback (#278)
This should improve compatibility with "Git Bash" with Git for Windows by
using psub+source init for all bash shells v4.1 and newer.
2019-09-04 09:23:31 -05:00
Kevin Song
6db0e20585 Change ZSH init to use jobstates for num jobs (#252) 2019-09-03 23:44:44 -04:00
Francisco Lopes
722a0652fd feat: Respect status.showUntrackedFiles 2019-09-02 20:27:04 -04: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
Quinn Strahl
3dd035056d Support vicmd_symbol in fish-shell (#254) 2019-08-31 00:59:18 -07:00
Nick Young
4eb7beca48 fix: Adds nix_shell to module::ALL_MODULES (#264)
So that it can be configured in the user's prompt
2019-08-30 09:39:21 -04:00
Harry Mills
c2a1803681 Fix typo in comment (#260) 2019-08-29 12:40:25 -04:00
Neil Kistner
9853743eda feat: Add commit count for ahead/behind symbols (#247)
Add logic for the git status module to display the number of commits the index is ahead or behind next to the symbol.
2019-08-27 20:11:42 -07:00
Bruno Bigras
fa2d1c05a6 fix: use procsub in bash since termux has no stdin (#241) 2019-08-27 00:02:52 -07:00
Neil Kistner
e034253a5e feat: Add ability to use an alternate directory truncation style (#239)
* Add ability to use an alternate directory truncation style
2019-08-26 21:52:45 -04:00
Ivan Tham
cdea401589 refactor: just match enum (#236)
Remove forced unwrap since match is already exhausted
2019-08-26 14:47:34 -04:00
Bruno Bigras
0fa862a2e9 make the battery module optional for now (#234)
The 'battery' crate doesn't support Termux, so we are temporarily making the battery module optional.
2019-08-26 14:09:39 -04:00
TsubasaKawajiri
08aef016cd fix: battery percentage character on Zsh. #226 (#237)
on Zsh, battery percentage character would print %
this PR fixes print %{ -> %
2019-08-25 21:52:44 -04:00
Bruno Bigras
feb737190e Add nix-shell support (#173) 2019-08-25 11:41:20 -04:00
Matan Kushner
57e807fec6
style: Fix clippy warnings 2019-08-23 13:13:04 -04:00
Bruno Bigras
68cbcb91b7 Use full path to starship in all phases of init (#224) 2019-08-22 12:57:32 -07:00
Thomas O'Donnell
1478f8c2e9 Add support for detecting Python from Pipenv files (#221)
Added the ability to enable the Python module based on the existence of the a `Pipfile`.
2019-08-21 15:54:22 -07:00
Kevin Song
360ea988e5
Add ruby to default module ordering (#217) 2019-08-21 12:41:01 -07:00
Kevin Song
f06247d5d3 fix: Correct ZSH init on older ZSH versions (#213) 2019-08-20 23:49:07 -04:00
Saurav Sharma
075a76897c fix: Change panicking on unknown module to error print and support module listing flag (#197) 2019-08-20 00:42:25 -04:00
Kevin Song
0e82c19f37
feat: Implement a two-phase init which allows us to write normal init scripts (#168)
Implement a two-phase init procedure in starship. The first phase causes the shell to source a subshell, while the second phase (in the subshell) prints the main init script.

This allows us to have nice init scripts with good styling, comments, and no pile of semicolons. Even better, it works as a drop-in replacement, so we don't need to update the docs.
2019-08-19 18:44:53 -07:00