1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-09-28 05:09:01 +00:00
Commit Graph

71 Commits

Author SHA1 Message Date
Alexandru Macovei
c8a8086930 refactor: simplify print::handle_module 2021-01-22 11:50:12 -05: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
David Knaack
cf297ff25d
fix: apply nightly clippy & fmt suggestions (#1922) 2020-11-23 20:38:11 +01:00
Tilmann Meyer
d1e2c13a7c
fix: apply clippy suggestions (#1756) 2020-10-13 12:03:33 -04:00
Jan Katins
6426bbe3e4
feat: Add timings subcommand (#1629)
* feat: Add computational duration to all computed modules

This also means that in case we do some computations and these end up empty, we submit an empty module

* feat: Add timings subcommand

This outputs the timings of all computed modules, sorted by the duration it took to compute the module.

Useful for debugging why the prompt takes so long.

* feat: Add timings to explain output

* fix: Ensure that even empty custom modules get timings

* format main.rs

* feat: Only show interesting timings

* fix(tests): Change tests to look for empty string instead of None

* Use proper wording in timings help

* Revert "fix(tests): Change tests to look for empty string instead of None"

This reverts commit aca5bd1b03c48e1dee1b7ca91d66e2bda2d5a97c.

* fix(tests): Returning None in case the module produced an empty string

* fix: Ensure that linebreaks (and space) make a module not-empty

* Make cargo clippy happy

* Make Module.duration a proper Duration

* Only return a module if we would report it

* Change to cleaner way to return None for empty modules

* Avoid unnecessary module creation

* Simplify a string comparison

* Add timings to trace

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

Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2020-09-21 19:06:15 +02:00
Jan Katins
17e8115f16
docs: Improvements in docs for custom modules (#1615)
* docs: Clarify that commands will be passed in on stdin

* docs: Clearer instruction how to include individual custom modules

* docs: Include link to #1252 in docs for custom modules

That issue is used to share custom modules.

* docs: Remove reference to prompt_order

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

Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2020-09-01 19:07:12 +02:00
Matan Kushner
09672eeea7
fix: re-add add_newline to root config (#1598) 2020-08-18 18:58:29 +02:00
David Knaack
8b0f589486
fix(explain): align table correctly (#1482)
* fix(explain): align table correctly

* iterate over lines directly

* calculate desc_width with the actual space available

* custom unicode-aware textwrapping

* fix clippy error

* better width estimination

* explain +6

* move padding width into a constant
2020-08-05 19:16:59 +02:00
Zhenhui Xie
ec76fafff0
feat: refactor modules to use format strings (#1374) 2020-07-07 18:45:32 -04:00
Thomas O'Donnell
5b14f21394
refactor: latest suggestions from Clippy 2020-06-05 23:20:11 -04:00
Grégoire Geis
15dc486e72
Add support for custom modules. (#916) 2020-04-11 18:37:24 +02:00
Kevin Song
5655a90a28
fix: Restrict clear screen control code printing to fish (#865)
Wraps clearscreen print codes in a statement to detect fish shell, since it is a
workaround for a fish shell behavior.
2020-01-27 17:23:08 -06:00
Matan Kushner
3365beae09 test(nodejs): Port nodejs module tests from E2E to integraton (#867)
Replaces the existing nodejs module end-to-end tests with integration tests that don't require preinstalled environmental dependencies.

- Moved the tests to the same file as the module they test
- Created a render_module utility function for rendering modules within tests
- Removed Node.js installation during CI setup
- Add Shell to Context to allow for tests to not run shell-specific code
2020-01-26 16:37:18 -06:00
Jon Grythe Stødle
8e5fa60fc8 feat: Add the starship explain command (#699)
This adds the explain argument to Starship, which explains what the printed modules in the prompt are.
2020-01-01 23:19:08 -05:00
Jon Grythe Stødle
f898b22b55 fix: Clear before printing prompt (#739)
This clears any leftover text when the prompt updates in-place (e.g. Alt + Left/Right in fish shell)
2019-12-19 17:56:30 -05: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
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
(´⌣`ʃƪ)
77c25b60c2 fix: Don't print the first module prefix after a line-break (#473) 2019-10-07 00:46:46 +09:00
Zhenhui Xie
bc9e44f45c fix: Add disable configuration option to kubernetes module (#491) 2019-10-05 23:10:16 +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
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
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
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
谢祯晖
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
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
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
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
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
Bruno Bigras
feb737190e Add nix-shell support (#173) 2019-08-25 11:41:20 -04:00
Kevin Song
360ea988e5
Add ruby to default module ordering (#217) 2019-08-21 12:41:01 -07: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
Saurav Sharma
f54322f2ab feat: Add configuration for reordering the prompt module and disabling default order (#171)
Adds functionality for reordering the prompt module through the use of the prompt_order configuration option in starship.toml
2019-08-18 21:35:11 -07:00
Matan Kushner
d296432908
fix: Fix exception caused by the golang module
Fixes #148
2019-08-13 15:06:10 -04:00
John Letey
82cf484ced feat: Implement the prompt module for jobs (#85) 2019-08-12 13:42:33 -04:00
Matan Kushner
4c2e9c3304 fix: Move the battery to the newline before character (#139) 2019-08-11 21:46:12 -07:00
Kevin Song
3daf3ddf26 feat: implement timer module (#118)
Implement a timer module that takes a commandline argument, the number of seconds the last job took to complete, and displays it if appropriate.

Alters shell initialization files to compute this number using date +%s where needed.

Adds a config section to configure minimum amount of time before timer is shown (default is 2s)
2019-08-08 13:25:30 -04:00
Matan Kushner
0bc28c521d
feat: Add configuration for add_newline (#116)
- Replace TableExt with a Config trait that extends toml::value::Table
Add configuration for add_newline
- add_newline is a root-level configuration value. When set to false, the initial newline before the prompt is removed.
2019-07-27 18:25:13 -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
8239fbd12b
Refactor integration tests (#71)
- Create subcommands to be able to print modules independently
	- `starship prompt` will print the full prompt
	- `starship module <MODULE_NAME>` will print a specific module
		e.g. `starship module python`
	- Added `--path` flag to print the prompt or modules without being in a specific directory
	- Added `--status` flag to provide the status of the last command, instead of requiring it as an argument
- Refactored integration tests to be end-to-end tests, since there was no way in integration tests to set the environment variables for a specific command, which was required for the `username` module
- Moved e2e tests to `tests/testsuite` to allow for a single binary to be built
	- Tests will build/run faster
	- No more false positives for unused functions
- Added tests for `username`
- Removed codecov + tarpaulin 😢
2019-06-06 13:18:00 +01:00
Matan Kushner
5b989fcb9c
feat: Add battery module(#63) 2019-05-22 12:29:39 -04:00
Youssef Habri
08b238114e feat: Implement the prompt module for username (#56) 2019-05-19 22:26:12 -04:00
Matan Kushner
90d6e6cf0b
Implement the git status module (#45) 2019-05-13 22:43:11 -06:00
John Letey
d3ce00c516 Add Go version module (#44) 2019-05-11 23:58:45 -04: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
John Letey
0b9334f438 Add the package version segment (#35) 2019-05-01 10:45:56 -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