Commit Graph

98 Commits

Author SHA1 Message Date
David Knaack b9a4b08ac2
fix(rprompt): remove lprompt modules from `$all` again (#5067) 2023-07-06 11:32:17 +02:00
marcybell b8a167db57
refactor(Context): `set_config` method for `Context` (#5079)
* add `set_config` method to `Context`

* Made inline comment a doc comment

* use `default_context()` for `set_config()` test

* use `set_config()` in tests for `print.rs`

* set root config w `set_config()` (`print.rs` test)
2023-04-24 16:03:47 +02:00
David Knaack 5e78226a3f
fix(preset): add output-flag to avoid encoding issues (#4926) 2023-03-03 11:46:16 +01:00
David Knaack 5e123fcbce
chore: fix clippy warnings for rust 1.67 (#4855) 2023-01-27 18:33:24 +09:00
Florent Vilmart 10433e31ef
feat(config): Adds support for --profile <custom profile name> (#3467)
Co-authored-by: Kevin Song <chips@ksong.dev>
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2023-01-11 21:25:36 -06:00
David Knaack 5d4cb6ff8f
feat(env_var): Add support for env_var.VAR in format (#4497)
Co-Authored-By: Segev Finer <24731903+segevfiner@users.noreply.github.com>

Co-authored-by: Segev Finer <24731903+segevfiner@users.noreply.github.com>
2022-12-28 21:00:49 +01:00
David Knaack 6e38683c89
chore: fix new clippy lints (#4557) 2022-11-05 12:40:46 +01:00
David Knaack c5bffb5620
build: bump clap from v3 to v4 (#4413)
* build: bump clap from v3 to v4

* bump
2022-09-29 16:51:56 -05:00
David Knaack 6ac5df904b
refactor: replace `ansi_term` with `nu_ansi_term` (#4339) 2022-09-04 18:44:54 +02:00
Artyom Belousov c8a5adb412
feat: Add starship preset command (#4112)
* Add starship preset command

* Use ValueEnum for preset command

* Generate ValueEnum struct in build.rs

* Use absolute paths and refactor codegen

* Use dunce to canonicalize path

* Use raw string literal in include_bytes!

* Use .cloned()

* Apply fixes

* Fix path escaping

* Removed error message if stdout is unavailable

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

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2022-08-02 11:51:15 +02:00
Kian-Meng Ang 018b077630
chore: fix typos in comments (#4122) 2022-06-28 14:19:17 -04:00
David Knaack 0ae61c7758
chore(clippy): fix new lints (#4002) 2022-05-23 06:58:27 -04:00
David Knaack 18ad26f98d
feat: allow printing config file schema (#3737) 2022-04-01 17:14:05 +02:00
Rashil Gandhi e9e090e97e
fix(fish): Emit clear-screen escape sequence only in left prompt (#3588) 2022-02-14 13:11:55 +01:00
David Knaack 20cf200c3a
refactor: update clap to v3 (#3370) 2022-01-04 12:49:42 +03:00
Ryan Cohen 4deaa02d6f
feat: set a continuation prompt for supporting shells (#3322)
* feat: set a continuation prompt for supporting shells (#3134)

* docs: fixed wording of documentation

* fix: continuation prompt is now only set once

* fix(docs): fixed typo in advanced-config/README.md

Co-authored-by: Segev Finer <segev208@gmail.com>

* fix: update --continuation argument

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

* fix: updated continuation prompt

- PROMPT2 was fixed to be set only once in zsh.
- `continuation_symbol` and `continuation_format` were removed in
  place of a single variable; `continuation_prompt`.
- The continuation prompt was moved out of the character module.

* fix: ran rustfmt

* docs: updated continuation prompt docs

Co-authored-by: Segev Finer <segev208@gmail.com>
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2022-01-01 14:12:11 +01:00
Fred Cox c1f2d345aa
fix(escaping): move escaping to individual variables (#3107) 2021-11-01 22:18:45 +01:00
David Knaack c4439531d3
fix: only print root level config logs a single time (#3132) 2021-10-27 15:13:17 +02:00
David Knaack b22c54fccc
refactor: replace `term_size` with `terminal_size` (#3087) 2021-09-23 17:52:51 +02:00
Matthew (Matt) Jeffryes 5d0a38aca3
feat: Add a fill module to pad out the line (#3029) 2021-09-12 19:59:15 -04:00
Matthew (Matt) Jeffryes 79585dcb17
feat: Add support for RPROMPT (right prompt) (#3026)
Adds support for zsh, fish, and elvish.

Co-authored-by: Matan Kushner <hello@matchai.dev>
2021-09-08 15:45:27 -04:00
Marcin Puc 6598275e15
refactor: simplify iterator usage (#3017) 2021-09-02 11:48:29 -04:00
David Knaack 66159cd940
feat(explain): quote module values (#2931) 2021-07-29 22:45:03 -04:00
David Knaack af43aeefba
fix(clippy): fix new clippy lints (#2939) 2021-07-29 14:27:46 -04:00
Dario Vladović ee65297183
refactor(print): introduce `UnicodeWidthGraphemes` trait (#2670) 2021-05-02 09:55:26 +02:00
Vivek Malneedi d21400a478
feat: add support for tcsh (#2288)
* feat: add support for tcsh

* add tcsh to install.sh install message

* list tcsh in bug_report.rs and main.rs

* quote starship path

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

* fix job count

* add tcsh support to shell module

* fix STARSHIP_START_TIME undefined error

* preserve existing user precmd and postcmd, remove jobs support

* remove unnecessary parentheses

* minor script improvement

* removes parens from install script message

* Update docs/config/README.md

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

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2021-02-27 19:55:27 +01:00
Dietrich Daroch 96b36322e5
fix: Add a fallback prompt under TERM=dumb (#1594)
TESTED=Run it under `env`, `env 'TERM=dumb` and `env 'TERM=dumber`.
2021-02-17 18:53:42 +01:00
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