Commit Graph

797 Commits

Author SHA1 Message Date
David Knaack b4a14e3a80
test(hostname): fix `trim_at` test with unicode hostname (#3295) 2021-12-09 22:15:25 +01:00
Mikkel Mork Hegnhoj 365b295433
feat(azure): Azure module (#3275)
* Azure module

* make Semantic PR bot happy

* Responding to review

* Changing severity of logging event
2021-12-06 23:01:33 +01:00
arcnmx e3a88a6ec1
fix(git_branch): more robust handling of .git (#3290) 2021-12-03 15:15:31 -05:00
pejax 1109fd6997
feat: Add package version detection for sbt projects (#3274) 2021-12-03 01:56:06 -05:00
David Knaack 77182a9a22
chore(clippy): fix new clippy lints (#3294) 2021-12-03 00:54:56 -06:00
David Knaack e18c61cd68
fix(directory): improve truncation detection (#3266) 2021-11-26 13:07:28 +01:00
Ikko Ashimine 337154ad35
chore: fix typo in docker_context.rs (#3265)
enviroment -> environment
2021-11-23 17:56:16 +01:00
Gabriel Victor 779e53cd66
feat(module): Add `sudo` module (#3135)
* add feature - sudo module

* add sudo module identifiers and entry point

* fix test test_sudo_not_cached

* add test test_sudo_cached

* add `allow_windows` and `binary` options

* rustfmt sudo_x_cached and rmv them on windows

* add false `allow_windows` block windows test

* add `doas` cached/not_cached tests

* better description in `starship explain`

* fix `test_doas_cached` with `-n` flag

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

* rmv `binary` alternatives and their tests

* fix symbol and update config/README

* fix all mocks to use `sudo -n true`

* fix expected output in `test_sudo_cached`

* proper checking for blocked sudo

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

* add `allow_windows = true` to non-windows tests

* allow sudo_* tests to run on windows + fix parsed

* rustfmt `blocks_windows` test

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2021-11-15 06:46:13 +01:00
Matthew Donoughe c3e33ea1c7
feat: print-config subset of config (#3179)
* feat: print-config subset of config

* only print format helpers with format config

* improve help text

* also change argument name
2021-11-15 06:45:19 +01:00
David Knaack 6068bab872
build: bump toml_edit from 0.6.0 to 0.8.0 (#3225)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-11 05:58:47 -05:00
cbolgiano 8d80d2ef06
feat(python): Show value of PYENV_VERSION when present (#3144)
* 2872: Show value of PYENV_VERSION when present

* 2872: Run cargo fmt
2021-11-09 21:55:53 +01:00
Derek Wilson 8ae6548dc0
fix: save pipestatus in fish init functions (#3160) 2021-11-09 14:27:30 -05:00
t-mangoe b07abc990e
feat: style git repo root (#2010) 2021-11-09 14:12:40 -05:00
Matan Kushner 9df7c7d256
fix: replace battery with starship-battery (#3213) 2021-11-09 06:35:45 -05:00
Aaron Kollasch d1ce352528
feat(ruby): Add environment variable checks to ruby module (#3206)
* feat(ruby): Add environment variable checks to ruby module

* docs(ruby): describe version detection method
2021-11-08 21:21:09 +01:00
David Knaack 4ee1bdc2a4
fix(memory_usage): remove duplicate `%` handling (#3193) 2021-11-01 22:19:27 +01:00
Fred Cox c1f2d345aa
fix(escaping): move escaping to individual variables (#3107) 2021-11-01 22:18:45 +01:00
David Knaack 6e6ab9f212
fix: ignore scan_dir timeout in tests (#3184) 2021-10-30 10:52:48 +02:00
David Knaack c4439531d3
fix: only print root level config logs a single time (#3132) 2021-10-27 15:13:17 +02:00
Thomas O'Donnell 39e7b78cb2
feat: also read from DOCKER_MACHINE_NAME (#3175)
This adds support to also read the context from `DOCKER_MACHINE_NAME`
since it is a bit more user friendly.
2021-10-25 07:54:39 +02:00
David Knaack 48fca507f5
fix(configure): preserve formatting and comments (#3152)
* fix(configure): preserve formatting and comments

* preserve formatting in changed line

* add tests
2021-10-23 10:15:46 +02:00
Thomas O'Donnell c682329bd0
fix: Modules not working in fish RPROMPT (#3146)
This should fix some modules not working correctly in the fish
`RPROMPT`. I have done this the very naive way by simply duplicating the
code that is currently in the `fish_prompt` function to avoid having to
change the scope of any of the variables (currently all local).
2021-10-22 18:54:36 +02:00
Ikko Ashimine 425af13026
docs: fix typo in starship.ps1 (#3173)
preceeding -> preceding
2021-10-22 12:14:43 -04:00
Aman Kumar Sinha eb203ebe95
feat(fill): add disabled option for fill module (#3158)
* add disabled option for fill module

* update tests

* update docs
2021-10-21 14:27:32 +02:00
vypxl 614e0e2763
feat(package): Add support for crystal shards (#3147)
* add crystal shard (package) version support

* module package: crystal shard version: read shard.yml directly

* module package: add test for crystal shard version

* format src/modules/package.rs

* use yaml-rust instead of serde-yaml

* document shards package support

* Update docs/config/README.md

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

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2021-10-13 07:42:55 +02:00
Harry Sarson c20a998d15
fix: allow unset KEYMAP and STARSHIP_DURATION in zsh (#3124)
* allow unset KEYMAP and STARSHIP_DURATION in zsh

which prevents errors if a user has `set -u` on in there terminal.

* fix: allow unset KEYMAP and STARSHIP_DURATION in zsh
2021-10-09 19:13:49 +02:00
Ajeet D'Souza 671365b505
fix(init): Use stderr for init error message (#3131)
* Use stderr for init error message

* Add a dummy commit to appease the Semantic PR bot

Co-authored-by: Kevin Song <chips@ksong.dev>
2021-10-09 08:35:17 +02:00
Michael J. Ryan 94d7de7f4e
feat: Add starship_precmd_user_func support for PowerShell. (#3115) 2021-10-07 20:08:31 +02:00
Rashil Gandhi 6464693165
fix(fill): Add `terminal-width` argument to explicitly define terminal's width (#3090)
Add `terminal-width` argument to explicitly define terminal's width
Update pwsh,bash,zsh,fish init scripts with `terminal-width` argument

Co-authored-by: Kevin Song <chips@ksong.dev>
Co-authored-by: Kevin Song <4605384+chipbuster@users.noreply.github.com>
2021-10-06 16:36:28 -05:00
Ian Wahbe dfb1208787
feat: Add pulumi module (#3055) 2021-10-05 18:27:25 -05:00
Kevin Song 190743e4e0
fix: pipestatus quoting on Zsh/Bash (#3088)
Changes the parsing for pipestatus to allow for multiple arguments, a
single argument of space-separated values, or any mix of the two. All
inputs are flattened into a single array where no elements have spaces
in them.

Changes the initscripts to no longer fail when an empty pipestatus
is passed as an argument by quoting and changing expansions.
2021-10-05 18:19:55 -05:00
Aman Kumar Sinha f8e81a1622
feat(shell): Add style config for shell module (#3108)
* add style config for shell module

* update shell docs

* fix formatting

* update tests
2021-10-04 19:46:33 +02:00
Thomas O'Donnell e74f428615
fix(terraform): Improve module triggers (#3113)
Have updated which extentions trigger the terraform module, to remove
the `hcl` since this gives false positives as it is used by other
Hashicorp products and add the `tfstate` and `tfplan` which are more
accurate indicators.
2021-10-04 18:08:58 +02:00
David Knaack 8f82457c2d
feat(explain): allow specifying prompt arguments in explain and timings subcommands (#3042) 2021-10-03 16:08:18 +02:00
David Knaack 68694029c4
fix(status): Don't show status if all exit codes are 0 (#3109)
* fix(status): Don't show status if all exit codes are 0

* fix tests
2021-10-03 16:03:09 +02:00
David Knaack ab25bc82c5
fix(windows): make powershell init work on windows 8 again (#3067) 2021-09-25 14:07:23 -05:00
David Knaack b22c54fccc
refactor: replace `term_size` with `terminal_size` (#3087) 2021-09-23 17:52:51 +02:00
David Knaack 20af85f0a8
docs(modules): add missing module descriptions (#3081) 2021-09-17 16:16:02 -05:00
David Knaack 75feef62cb
fix(print-config): add missing `format_right` to `FullConfig` (#3063) 2021-09-15 17:58:58 +02:00
Tom Most bbb8d3c357
fix(package): Ignore setup.cfg attr: and file: (#3054)
The setup.cfg version key allows "attr:" and "file:" directives to load
the actual value from elsewhere [1]. Treat these as if no version was
found, since the text of the directive isn't the version number we're
after.

[1]: https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html#specifying-values
2021-09-14 12:17:05 -05:00
Matthew (Matt) Jeffryes 5d0a38aca3
feat: Add a fill module to pad out the line (#3029) 2021-09-12 19:59:15 -04:00
David Knaack 5ac7ad741f
fix(zsh): always escape percent character (#3058) 2021-09-12 19:55:46 -04:00
Matthew (Matt) Jeffryes e64a99262e
fix(zsh init script): avoid adding preexec commands twice (#3049) 2021-09-09 16:19:01 -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
Bill 08b5cd0862
feat(cobol): added COBOL module (#2994)
* feat: added COBOL module

* slight README fix

* added command faking for COBOL

* updated COBOL symbol to better suit language

Co-authored-by: Bill Risher <bill@encephaloinvestments.com>
2021-09-07 09:59:14 -05:00
Alexandru Macovei 7388c5a79e
fix(config): inherit stdin/stdout/stderr instead of piping to fix editor invocation (#3032)
Due to the introduction of utils::create_command, commands now have
stdin set to null, and stdout and stderr set to piped.
This prevents console editors from working when invoked via
starship config
2021-09-03 21:56:43 -04:00
Marcin Puc 6598275e15
refactor: simplify iterator usage (#3017) 2021-09-02 11:48:29 -04:00
Thomas O'Donnell 3933553486
fix(status): Showing exit code 0 with pipelines (#3028)
Have fixed a bug there the status module was showing when the exit code
was 0.
2021-09-02 00:18:44 +02:00
David Knaack c6e5e6fbed
feat(print-config): list expanded `$all` variable (#2932)
* feat(print-config): list expanded `$all` variable

* handle $custom

* improve comment
2021-09-01 20:32:32 +02:00
filip 6b13296741
feat(git_metrics): Git metrics show only nonzero diffs (#2887)
* implement only_nonzero_diffs configuration option

* update documetation
2021-08-27 09:38:46 -05:00
filip 1c9758f08b
style: Improve modules consistency (#3006)
* cmake - consistent parse version method names

* crystal - consistent parse version method names

* dart - consistent parse version method names

* deno - consistent parse version method names

* golang - consistent parse version method names

* helm - consistent parse version method names

* implement get_command_string_output, java - consistent parse version method names & small refactor

* julia - consistent parse version method names

* kotlin - consistent parse version method names and refactor

* lua - consistent parse version method names and refactor

* implement get_command_string_output for scala

* format crystal module

* remove outdated comment

* node use format_module_version

* terraform - consistent parse version method names

* vagrant - consistent parse version method names

* format

* refactor python module

* improve rlang module consistency

* fix clippy warning
2021-08-25 10:41:10 -05:00
David Knaack 9d3ec93d82
refactor: allow passing OsStr as-is to `exec_cmd` (#2997) 2021-08-23 18:49:30 +02:00
Elia Geretto 2e9223dd8c
fix(git_status): show working tree status if index status is present (#2973) 2021-08-18 19:55:40 +02:00
Thomas O'Donnell 9e5fcd1e14
feat(red,vlang): Add version formatting (#2987)
Have added version formatting to the red and vlang modules. Note the
docs for red already mentioned the `version_format` string but it had
not actually been added.
2021-08-15 21:30:58 +02:00
Alexander González 7038ae2ec8
fix(jobs): Add the symbol and number thresholds respecting the `threshold` option (#2908)
* feat: Add the symbol and number thresholds respecting the threshold option

* fix: Maintain the old behavior + add lots of tests

* docs: Fix the jobs module documentation
2021-08-14 15:29:25 +02:00
filip 3139c6b8a3
feat(git_status): dont render module output if not in git repository (#2897)
* refactor get_repo method to not swallow error

* module git status don't render if not in git repository
2021-08-14 15:19:43 +02:00
Bill b2e2330cb0
feat(git_status): added symbol for local repos up-to-date with remote. (#2945)
* git_status: added symbol for when local branch is up-to-date with upstream

* updated docs

* removed unused variable, moved location of config comment

* changed uptodate default to empty string, simplified and made safer

* added uptodate default line back into docstring

* fixed linting and formatting errors

* refactored uptodate to up_to_date, removed redundant else statement
2021-08-07 19:22:00 +02:00
Thomas O'Donnell b7b7df9885
feat(package): Add ability to format the version (#2959)
Have added the ability to use format the version of the package using
the `version_format` option. While doing this I have also done some
refactoring of the module to remove the if/else if/... block and replace
it with an iterator. This should make fix some edge cases where versions
are not correctly picked up due to other files an example would be a
python project that has a `pyproject.toml` file but using the
`setup.cfg` for the package version. It should also make it easier to
make the order of the list configurable in the future.
2021-08-06 21:16:14 +02:00
David Herberth cd6fc9cea0
feat(kubernetes): implements regex matching for context aliases (#2883) 2021-08-03 23:56:28 +02:00
filip b1db771baa
fix(rlang): module not working on MacOs (#2880)
Fix rlang module and refactor other modules to use new method.
2021-08-02 13:13:29 -04:00
David Knaack b0853876ea
fix(print-config): fix battery module and add missing modules (#2930)
* fix(print-config): fix battery and vcsh module handling

* sort, add test, add line_break module
2021-07-30 13:33:59 -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
Hugues Morisset 40cb667b9d
feat(status): Add pipestatus display in status module (#2481)
* feat: Add pipestatus display in status module

This MR is based on this one https://github.com/starship/starship/pull/370

* Documentation

* Add a test with map_symbol false

* Handle bash preexec pipestatus

* Add zsh support

* Add fish support

Thanks kidonng for the diff patch

* Rename sucess_symbol to success_symbol
2021-07-28 12:26:00 -04:00
Tom 2fa7f56cec
feat(package): Support package version from setup.cfg (python). (#2890)
* Support package version from setup.cfg (python).

Add an additional package version extraction function to parse
the 'version' attribute under the 'metadata' section in a python
package 'setup.cfg' file.

Also add similar tests from the poetry extraction function to test
the desired behaviour.

This adds a dependency on ConfigParser:
https://crates.io/crates/configparser.

* Clean up comments

* Use rust_ini over ConfigParser

* Add mention to setup.cfg version parsing in docs
2021-07-27 17:58:35 +02:00
dependabot[bot] 35d9a9097b
build: bump open from 1.7.1 to 2.0.0 (#2916)
* build: bump open from 1.7.1 to 2.0.0

Bumps [open](https://github.com/Byron/open-rs) from 1.7.1 to 2.0.0.
- [Release notes](https://github.com/Byron/open-rs/releases)
- [Changelog](https://github.com/Byron/open-rs/blob/main/changelog.md)
- [Commits](https://github.com/Byron/open-rs/compare/v1.7.1...v2.0.0)
2021-07-26 11:12:10 -04:00
David Knaack 31932c2990
fix(init): remove quotes in bash init (#2893) 2021-07-17 18:05:07 +02:00
Jeremy Schlatter b1dcd5aecd
feat: add support for xonsh (#2807)
* feat: add support for xonsh

* xonsh: add STARSHIP_SESSION_KEY

* xonsh: implement STARSHIP_SESSION_KEY in xonsh

* docs: mention tcsh, elvish, and nu in more places

* xonsh: change STARSHIP_SESSION_KEY implementation

See https://github.com/starship/starship/pull/2807#discussion_r667064149

* xonsh: fix jobs implementation

* xonsh: do not silently discard stderr from starship
2021-07-16 15:25:01 -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
filip 88ed0ed45a
feat(env_var): allow multiple instances (#2797)
Allows displaying multiple instances of the env_var module.
2021-07-13 17:06:08 -04:00
Chrissy LeMaire c9249dbe0b
fix(pwsh): replace Get-Error with $error[0] (#2873)
Get-Error does not exist in all versions of PowerShell, and attempting to use it on machines where it does not exist pollutes $error. Someone may be tempted to use -ErrorAction Ignore but since the command does not exist, it still ends up in $error

This is a dual bug fix because it actually gets errors on all machines now and it does not pollute $error.
2021-07-13 16:31:14 -04:00
Alexander Gonzalez 9f337d15e7
feat: Add the `git_metrics` module (#2827)
This PR adds a new module named git_metrics. It shows the added/deleted lines in the current git repository following the format: "[+$added_lines]($added_style) [-$deleted_lines]($deleted_style)".
2021-07-10 16:54:34 -04:00
David Knaack 9126d78d0e
fix(nu): use correct session key variable name (#2874) 2021-07-10 12:14:42 +02:00
Thomas O'Donnell 9e2da88d95
fix(git_status): Fix when the worktree != root dir (#2831)
Have updated the git_status module to work if the worktree has been
changed to a different directory than the repository root directory.
2021-07-05 17:19:09 -04:00
David Knaack cea1a1ceb1
feat: add support for nu shell (#2847) 2021-07-04 15:32:58 -04:00
Kid 196cc8aa39
fix(dotnet): make default format consistent with other modules (#2853)
Add via prefix to dotnet modules' default format config.
2021-07-04 10:32:47 -04:00
filip bdac951168
refactor(git_commit): small refactor to remove duplicate code (#2752) 2021-07-04 15:29:21 +02:00
Lorenzo Tucci 446ef03b4d
feat(docker_context): Use DOCKER_HOST and DOCKER_CONTEXT enviroment variables (#2782)
* feat(docker_context): Use DOCKER_HOST and DOCKER_CONTEXT enviroment variables for docker context

* Updating documentation for Docker context
2021-07-03 23:38:39 +02:00
David Knaack a4a2adb0f8
fix(init): improve starship path escaping (#2848) 2021-07-03 23:30:27 +02:00
Giovanni Bassi 5d679d82cc
perf: Improve custom config OS (#2843)
Related to #2750 and #2751.
Moving the OS check before other checks so that
there is no performance hit for running the
match in the incorrect OS
2021-07-02 20:04:17 +02:00
Andrew Houts 2acd98248b
style: enforce ALL_MODULES ordering in test (#2837)
* style: enforce ALL_MODULES ordering in test

* use unstable sort

* use copied instead of dereferencing in iterator
2021-07-02 20:00:46 +02:00
Andrew Houts 5901ec026f
style: fix name of battery info provider implementation (#2836)
* fix name of battery info implementation

* empty commit for squash
2021-06-29 21:12:59 -04:00
Andrew Houts 53a30046d1
test(battery): add battery tests (#2795)
Add some tests to the battery module, make it testable by mocking out the code that fetches battery info.
2021-06-29 19:46:41 -04:00
filip 72e5a544fc
feat: treat empty string as none when formating (#2738)
* treat empty string as none when formating

* update docs

* format & clippy
2021-06-29 19:33:43 -04:00
Shogo Takata 94248f7a69
fix(rust): support for `rust-toolchain.toml` (#2775)
* Add support for `rust-toolchain.toml`

* fix(rust): support for `rust-toolchain.toml`

* This commit adds support for `rusttoolchain.toml`.
* Added some tests.
* Added some comments on what the tests are checking.
* Changed code for `read_channel` to match the behavier of rustup.

* Update src/modules/rust.rs

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

* Update rust module

Added back the functionality to cache

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2021-06-25 17:12:33 +02:00
David Knaack a78c6692d9
fix(clippy): fix additional clippy lints in tests (#2813) 2021-06-21 14:13:10 -04:00
David Knaack bddf5bf1d1
fix(clippy): fix new lint warning (#2803) 2021-06-16 21:23:14 +02:00
Javier Goday fa3899719b
feat: Add Operating System condition to custom commands (#2751)
* #2750: Add Operating System condition to custom commands

* update custom module config docs

* fix os field name in custom module

* Fix custom module false positives (when && os conditions)

* Custom module operation system: check unix family

* Custom module operation system: fix check unix family (use cfg!(unix))

* 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>
2021-06-13 08:23:46 +02:00
Rumia 5edaa90d67
fix(dotnet): Don't treat folder with .sln file as a .NET project (#2785)
* Don't treat folder with .sln file as a .NET project

* Update docs for .NET detect_extensions changes
2021-06-05 16:18:34 +02:00
Jimmy Royer 8d3aa3b304
feat(r-lang): add module for R programming language (#1475)
* feat(formatter): Allow scoped variables (#1094)

* feat: Allow scoped variables

, with the following improvements to the format string parser.

- Add documentation to spec
- Simplify some syntax in the spec
- Rewrite for loop with iterators

* Added support for R programming language.

* Removed unnecessary debug log used during dev process.

* Make the `R` command upper case as the *nix OS executables are case sensitives and the correct command is upper-case.

* Changed comments to reflect R features (rather than node.js where code was coming from).

* feat(format_string): Allow positional segments (#1138)

* feat(format_string): Allow using variables in a style string (#1130)

* fix(format_string): Allow multiple variable mappers (#1142)

* refactor: Add error handling to variables (#1148)

* Squashed commit of changes with meta variables:

commit 5beb3bca18f0b0c822b740afb3778ccb1e3a7d19
Author: heyrict <xiezh0831@yahoo.co.jp>
Date:   Mon Apr 27 09:52:59 2020 +0800

    fix: Cache variables in meta variables properly

commit 49b9324942dd55350c87107d0e8c7d1592d92e8a
Merge: cc575bc 260a1ab
Author: heyrict <xiezh0831@yahoo.co.jp>
Date:   Sun Apr 26 21:34:52 2020 +0800

    Merge branch 'feat/format-string' into meta-variables

commit cc575bc27cbf87c4197e96d2fa5416d4932e45d7
Merge: 3ed2d32 e0c1901
Author: heyrict <xiezh0831@yahoo.co.jp>
Date:   Sun Apr 26 12:16:12 2020 +0800

    Merge branch 'feat/format-string' into meta-variables

commit 3ed2d326c9f625930bdd72cea736c1d0eab6d381
Author: heyrict <xiezh0831@yahoo.co.jp>
Date:   Sun Apr 26 11:06:28 2020 +0800

    refactor(format_string): Allow returning error in variable mapper

commit 766732fe697df947538fe12ca92a8eb8e7bfea3e
Author: heyrict <xiezh0831@yahoo.co.jp>
Date:   Sat Apr 25 22:56:02 2020 +0800

    fix: Add test for StyleVariableHolder

commit 444334ad206a68132fa6257b83c3992b7b790981
Merge: 479d4a7 9796a66
Author: heyrict <xiezh0831@yahoo.co.jp>
Date:   Sat Apr 25 22:52:27 2020 +0800

    Merge branch 'positional-segments' into style-variables

commit 9796a66a9679597676e7fd859197fd542e8042dc
Author: heyrict <xiezh0831@yahoo.co.jp>
Date:   Sat Apr 25 22:51:26 2020 +0800

    test: Add tests for VariableHolder

commit 479d4a72fa58fd8aa777acd8228d4834407a7b6a
Author: heyrict <xiezh0831@yahoo.co.jp>
Date:   Sat Apr 25 22:41:47 2020 +0800

    feat: Add trait StyleVariableHolder

commit 21d40c6f4e2d12b34fdec4e2e38b6ad0f91217a3
Merge: 3b459f4 e7dd987
Author: heyrict <xiezh0831@yahoo.co.jp>
Date:   Sat Apr 25 22:17:11 2020 +0800

    Merge branch 'positional-segments' into style-variables

commit e7dd987fd7b01a82c6012ba7055d1dd9b5fd84aa
Author: heyrict <xiezh0831@yahoo.co.jp>
Date:   Sat Apr 25 15:10:12 2020 +0800

    misc: Minor changes on docs and codes

commit 71020b0397a86e850ad5beda926aa9416250025c
Author: heyrict <xiezh0831@yahoo.co.jp>
Date:   Fri Apr 24 20:51:45 2020 +0800

    feat(format_string): Add syntax for positional segments

commit 3b459f4379b08defce50c57a903502513ad1b2b6
Author: heyrict <xiezh0831@yahoo.co.jp>
Date:   Wed Apr 22 17:49:15 2020 +0800

    fix: Fix clippy

commit 2fb052d68cb46680c081f5a0e25e2c3fbdc9e204
Author: heyrict <xiezh0831@yahoo.co.jp>
Date:   Wed Apr 22 17:02:09 2020 +0800

    feat: Add map_style method to feed values in style string

* fix: Change error type of StringFormatter::new

* fix: Fix rustfmt

* tests: Add tests to variable errors

* docs: Add documentation

* chore: Rename positional to conditional (#1166)

* docs: Add docs for format strings (#1083)


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

* refactor(rust): Use format strings (#1063)

* Updated to latest string formatter's changes.

* feat(format-string): add format string support to battery module (#1158)

* update battery module with format string

* update battery module docs

* update battery module with format string

* update battery module docs

* fix battery module with new StringFormatter api

* fix clippy warnings

* Update docs/config/README.md

Co-authored-by: Zhenhui Xie <xiezh0831@yahoo.co.jp>

* battery symbols now supports format-string

* battery symbols now support format-string
remove space between symbol and percentage
fix battery config

Co-authored-by: Zhenhui Xie <xiezh0831@yahoo.co.jp>

* refactor(golang): Use format strings (#1066)

* refactor(golang): Use format strings

* docs(golang): Update docs

* docs(golang): Update docs

* fix: Update to upstream API changes

* docs(golang): Update docs

Co-authored-by: heyrict <xiezh0831@yahoo.co.jp>

* Fixed a few inconsistencies.

* Removed string clone in favor of a reference.

* Update src/modules/r.rs

Reverting the r version string formatting to a more idiomatic way of handling it.

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

* Update src/configs/r.rs

Co-authored-by: Zhenhui Xie <xiezh0831@yahoo.co.jp>

* Updated documentation to reflect changes in config.

* refactor(java): Added formatter support for Java module. (#1084)

* refactor(haskell): Added formatter support for the Haskell module. (#1111)

* Added formatter support for the Haskell module.

* Updated haskell module with latest formatter code changes.

* Changed documentation for latest Haskell string formatter changes.

* Fixed a few inconsistencies.

* Removed unnecessary variable cloning for using reference instead.

* refactor(env_var): Added formatter support for the env_var module (#1180)

* refactor(memory_usage): Added formatter support for memory_usage module (#1182)

* Migrated the memory usage module to string formatter' support.

* Fixed a few inconsistencies.

* Removed cloning of variables to instead use references.

* refactor(cmd_duration): Use format strings (#1200)

* Fixed format issue in code.

* Fixed compilation error after adding new 'r' module in root config.

* Added .Rproj extension file to be detected with R prog lang.

* Aligned R module code with existing ones.

* Update src/configs/r.rs

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

* fix: Added rconfig to fullconfig and fixed broken api calls

* Apply suggestions from code review

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>

* Update src/modules/r.rs

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>

* Addressed PR comments.

Cleaned up code and fixed code errors.

* Updated docs for consistency purpose.

Co-authored-by: Milo <50248166+Milo123459@users.noreply.github.com>

* refactor: Renamed the `r` module to `rlang`

* test: Provided R fixture and R module renderer test

* doc: Updated rlang mod config to reflect latest detection changes

* fix: Added missing rlang entry in config/mod

* feat: Added version formatted fined grained configuration

* Added version_format in R lang documentation.

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

* review: Addressed later comments

* fix: README was missing a previously present section for Python

* Fix: Test was not updated for previous version string upgrade.

* fix: Upgraded R version in remaining test.

Co-authored-by: Zhenhui Xie <xiezh0831@yahoo.co.jp>
Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
Co-authored-by: Luca Rinaldi <lucarin@protonmail.com>
Co-authored-by: John Letey <johnletey@gmail.com>
Co-authored-by: Tilmann Meyer <47182955+ATiltedTree@users.noreply.github.com>
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>
Co-authored-by: Milo <50248166+Milo123459@users.noreply.github.com>
2021-05-25 14:13:30 -04:00
David Knaack 78b84c9f34
fix(git_commit): remove unwraps (#2743) 2021-05-19 19:08:48 +02:00
Thomas O'Donnell 1612212b63
refactor(utils): Add extra logging to read_file (#2742)
Have added some additional logging to the `read_file` util to make
debugging issues easier.
2021-05-18 23:30:00 +02:00
Chris ae6c69b13b
fix: remove trailing whitespace from Terraform version (#2726) 2021-05-15 22:36:59 -04:00
Carl-Louis Van Brandt 69a754573d
feat(aws): add temporary credentials countdown (#2464) 2021-05-12 20:43:46 -04:00
Munif Tanjim baabc7743d
fix(zsh): preserve zle-keymap-select (#2717) 2021-05-12 22:14:48 +02:00
Pratik Chaudhary f3984eaf16
feat(package): add support for nimble project package version (#2569)
* feat(nim): add support for nimble project package version

* Replace find_file with context scanner. Fixes the failing tests.

* Replace `utils::exec_cmd` with `context.exec_cmd` so that it uses
global timeout

* Add tests for nimble project version

* Add docs for nimble in package version module for english language

* Update docs/config/README.md

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

* Add test for a case when nimble is not available

* Remove extract_vlang_version

I don't know why it did not come up while I was fixing merge conflicts
on rebase.

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2021-05-09 06:38:16 +02:00
Jason-S-Ross 3b37bcd063
fix(git_commit): leading space in git commit tag (#2697)
* Move git_commit tag leading space into config

Fixes #2692

* Update doc default commit tag
2021-05-08 21:01:00 +02:00
John Breen 45bb13047d
fix(git_status): Show git add -N files as unstaged (#2702) 2021-05-07 19:31:18 -04:00
Dario Vladović c4f977c48d
feat(vlang): support `vpkg` (#2686) 2021-05-07 10:22:18 -04:00
David Knaack 6f387769fe
fix(memory_usage): prevent used swap underflow on windows (#2689) 2021-05-04 11:28:44 -04:00
Dario Vladović 41e417e1d3
fix: add missing project filter rules (#2687) 2021-05-04 08:57:38 +02:00
Milo 48f913ec23
feat(vlang): create module (#2577)
* Add V module

* Format

* Fix tests

* fix typo

* Update src/configs/v.rs

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>

* Update docs/config/README.md

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>

* Update docs/config/README.md

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>

* Update docs/config/README.md

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>

* Use blue bold

* v -> vlang

* change docs

* More vlang fixes

* add package support for v

* Update docs/config/README.md

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>

* use regex

* Update src/configs/mod.rs

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

* apply patch

* fix

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2021-05-03 21:50:29 +02:00
Dario Vladović dead06ba14
test(ocaml): test custom switch indicators (#2657) 2021-05-03 21:48:58 +02:00
Dario Vladović ee65297183
refactor(print): introduce `UnicodeWidthGraphemes` trait (#2670) 2021-05-02 09:55:26 +02:00
Rashil Gandhi 1979331d47
feat(shell): add unknown_indicator parameter (#2649)
* Add default config parameter for shell

* Update docs for shell default parameter

* Change parameter to more obvious name
2021-04-30 20:48:05 +02:00
Dario Vladović ff3c893a76
feat(gcloud): introduce separate `account` & `domain` format string variables (#2594)
* feat(gcloud): split gcloud profile into `account` & `domain` format variables

* docs(gcloud): update documentation

Co-authored-by: Filip Bachul <filip.b@masterborn.com>
2021-04-30 08:19:54 +02:00
Dario Vladović d242d40db6
feat(gcloud): honor `CLOUDSDK_CORE_PROJECT` env variable (#2596)
Co-authored-by: Filip Bachul <filip.b@masterborn.com>
2021-04-30 08:13:51 +02:00
filip 540c2c2475
feat: Add version formating for modules (#2611)
* format crystal version with VersionFormatter

* update crystal dosc

* format crystal module

* fix typos

* format dart version with VersionFormatter

* fix dart malformed test

* update dart docs

* format cmake version with VersionFormatter

* update cmake docs

* format deno version with VersionFormatter

* update deno docs

* remove Version type

* format dotnet version with VersionFormatter

* update dotnet docs

* format erlang version with VersionFormatter

* update erlang docs

* format golang version with VersionFormatter

* refactor formatting in my modules

* format helm version with VersionFormatter

* format julia version with VersionFormatter

* format kotlin version with VersionFormatter

* format lua version with VersionFormatter

* format nim version with VersionFormatter

* format perl version with VersionFormatter

* format php version with VersionFormatter

* format purescript version with VersionFormatter

* format scala version with VersionFormatter

* format swift version with VersionFormatter

* format terraform version with VersionFormatter

* format vagrant version with VersionFormatter

* format zig version with VersionFormatter

* format elixir version with VersionFormatter

* format ocaml version with VersionFormatter

* update elixir docs

* update golang docs

* update helm docs

* update julia docs

* update kotlin docs

* update lua docs

* update nim docs

* update ocaml docs

* update perl docs

* update php docs

* update purescript docs

* update scala docs

* update swift docs

* update terraform docs

* update vagrant docs

* update zig docs

* format elm version with VersionFormatter

* update elm docs

* pass module_name as &str to format_module_version
2021-04-29 23:22:20 +02:00
Tom Golden c2e84e1802
feat: abbreviate package.json semantic versions (#2271) 2021-04-29 15:06:25 -04:00
Dario Vladović 8a8dca71a6
fix(gcloud): add double space after cloud emoji symbol (#2666)
* fix(gcloud): add double space after cloud emoji symbol

* docs(gcloud): update docs
2021-04-29 19:18:20 +02:00
Kid 16855fe8e2
fix(fish): explicitly set scope in fish init script (#2636)
* fix: use correct scope in fish init script

* Prefix variable names with Starship

* Use `functions -e` to remove `fish_mode_prompt`

* Update src/init/starship.fish

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>
2021-04-29 19:16:10 +02:00
Felipe Seré 0e23526f5f
fix(zsh): Reverts changes to background jobs retaining improvements around START_TIME (#2638)
* Revert "fix(zsh): Set PROMPT just once (#2428)"

This reverts commit 6fd7d7b501.

* Reintroduce fixes around START_TIME

* Bring back disabling virtualenv

* Expand the jobstates before passing the number to starship

Credit goes to @vladimyr
2021-04-29 16:16:25 +02:00
Dario Vladović 67e0eb0e9a
refactor: read CLI options as `str` (#2656) 2021-04-28 20:39:32 +02:00
David Knaack 8f464e4c1d
fix(print-config): add red module to Default impl (#2652) 2021-04-26 20:26:05 +02:00
David Knaack cd50b354a3
fix(print-config): use proper defaults for top-level values (#2605) 2021-04-26 19:55:22 +02:00
David Knaack 603da24852
fix(configure): fix launching .cmd editors (#2635) 2021-04-24 00:10:19 +02:00
Dario Vladović 4fda947cda
refactor(gcloud): lazily read active gcloud config (#2592)
* refactor(gcloud): lazily read active config once

* refactor(gcloud): wrap gcloud config with `GcloudContext`
2021-04-23 08:27:53 +02:00
Florent 2deaa572af
feat(config): Add support for `inverted` token in style strings (#2589)
* Add support for `reverse` keyword in style strings

* Duplicate test case and keep original

* Rename keyword to `inverted`

* Add explanatory sentence in readme
2021-04-22 12:09:21 -04:00
Kid aaf1f246d7
fix(nodejs): Check for `.nvmrc` (#2626)
* feat(nodejs): Check for `.nvmrc`

* Fix test
2021-04-22 12:08:12 -04:00
Andrew McClenaghan 8bf69cbaa8
feat(aws): Add support for profile from awsume (#2609) 2021-04-20 18:35:07 +02:00
Milo 83c906457e
feat(red): create module (#2599)
* create module

* fmt

* fix clippy

* fmt even though i already did it

* add all extensions

* tests for .reds

* change from circle to triangle

* remove hi.red

* fix test name

* update variables

* fix comment

* Update docs/config/README.md

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>

* Update docs/config/README.md

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>

* apply patchs

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>
2021-04-20 18:31:47 +02:00
Anthony Huang 3f2d6cc068
fix(jobs): Handle zero jobs with zero thresholds (#2613)
* Handle zero jobs with negative thresholds

* Allow for zero threshold only

* Log when threshold is less than zero

* Address comments

* Add docs
2021-04-20 18:30:22 +02:00
t-mangoe 1ee59ed18c
feat(battery): Add a symbol option to `battery.display` (#2475)
* feat: Add a symbol option to `battery.display`

* feat: Add a symbol option to `battery.display`

* use `impl defaulat` instead of `RootModuleConfig`

* edit the code according to clippy's linting

* change variable type to `Option<'a str>`

* update the documentation on the battery module

* updated documentation and source code according to review comment

* remove the unnecessary method and write the default value of BatteryDisplayConig to the document

* add 'charging_symbol' option to battery.display
2021-04-17 13:52:46 +02:00
Milo 3cb15abfc5
feat(deno): create module (#2565)
* Add deno module

* Update docs

* Update src/utils.rs

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>

* Update src/modules/deno.rs

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>

* Update src/modules/deno.rs

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>

* Update src/modules/deno.rs

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>

* Update src/modules/deno.rs

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>

* run rust fmt

* Use deno -V

* fmt

* Fix deno module

* do clippy

* Update src/configs/deno.rs

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

* Update src/modules/deno.rs

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

* Update docs/config/README.md

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

* Fix test and docs

* Remove unused code

* fmt

* update configs

* Add more tests

* Update docs/config/README.md

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2021-04-15 15:22:12 +02:00
Dario Vladović 51c2ae0a28
fix(elixir): correctly parse dev and rc versions (#2573) 2021-04-15 08:48:12 +02:00
Dario Vladović f765ca3b3f
refactor(scala): parse version w/o regex (#2574) 2021-04-15 08:47:00 +02:00
Dario Vladović 49f5b9c439
refactor(lua): parse version w/o regex (#2575) 2021-04-15 08:46:29 +02:00
Dario Vladović fe030c2064
refactor: propagate version formatting errors (#2566)
* refactor: propagate version formatting errors

* refactor: trim version formatting boilerplate

* refactor(node): unwrap version formatting

* docs: fix typo

* docs: remove dots after `version_format`

* feat: lazy version parsing

* refactor(version-formatter): collect segments into string
2021-04-10 19:06:25 +02:00
David Knaack 436eb61efd
test: allow running tests as root (#2571) 2021-04-10 19:05:46 +02:00
Chris Rose 6817e7f698
feat: add version format configuration (#2499) 2021-04-08 18:37:54 -04:00
David Knaack 8af677c811
feat(config): print a suggestion for unknown fields (#2560)
* feat(config): print a suggestion for unknown fields

* Fix typo

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

Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2021-04-06 22:12:37 +02:00
Dario Vladović c7d5ce72b5
refactor(init): cleanup init stub (#2548)
* refactor(init): cleanup init stub

* refactor(init): use iex PowerShell alias

* fix(init): prevent bash scope pollution

* refactor(init): update PowerShell snippet
2021-04-05 16:52:10 +02:00
Charles Swartz 2b0010ffe3
feat(python): Remove parentheses from pyvenv.cfg prompt parameter (#2551)
* Remove parentheses from pyvenv.cfg prompt

* Apply suggestions from initial code review

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>
2021-04-05 16:51:01 +02:00
David Knaack b791383a94
fix(configure): fix print-config issues (#2556) 2021-04-05 16:47:49 +02:00
Dario Vladović e19f79bfd3
style(battery): add space between icon and text for better visual (#2547)
* style(battery): add space between icon and text for better visual

* docs(battery): update docs

Co-authored-by: LitoMore <litomore@gmail.com>
2021-04-03 13:10:45 +02:00
Dario Vladović dbb6885724
feat(ocaml): add `switch_indicator` and `switch_name` variable (#2503)
* feat(ocaml): add switch variable

* feat(ocaml): configurable opam switch display

* docs(ocaml): document opam switch display options

Add `global_switch_indicator` and `local_switch_indicator` config
options.

* style(opam): add `OpamSwitch` type alias

* fix(opam): gracefully handle empty opam switch

Co-authored-by: cdaringe <cdaringe@gmail.com>
2021-04-02 19:21:48 +02:00
Thomas O'Donnell 7779ed6075
style(directory): Add comments for test settings (#2538)
Have added some comments to explain the settings we are using in some
tests.
2021-04-02 06:18:40 +02: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 51972801de
feat(config): warn about unknown config key names (#2527) 2021-03-31 20:13:23 +02:00
David Knaack 9d15eb135b
test(directory): fix on windows without admin (#2497) 2021-03-31 18:00:24 +02:00
David Knaack d06ba072a8
feat(config): allow printing default and computed config (#2521)
* feat: allow printing default and computed config

* fix custom modules

* actually fix custom modules
2021-03-31 17:31:55 +02:00
Caleb Maclennan f13e44c730
feat(vcsh): Add new module for VCSH (#2513)
* feat(vcsh): Implement new VCSH module

* test(vcsh): Add unit tests for VCSH module

* docs(vcsh): Document VCSH module
2021-03-28 17:48:15 +02:00
Dario Vladović 404b4f3d0c
refactor(username): reformat code to match docs (#2517) 2021-03-27 22:13:20 +01:00
Dario Vladović 1336944ab7
refactor(singularity): use `?` operator (#2518) 2021-03-27 18:53:54 +01:00
David Knaack cf68f54611
fix(context): remove unwrap when pwd is unavailable (#2520) 2021-03-27 11:46:05 -04:00
Dario Vladović c8a787475c
refactor: use `unwrap_or_default` (#2516) 2021-03-26 21:01:20 +01:00
Thomas O'Donnell e0da57df3f
style(init): Cleanup the unknown shell message (#2444)
* style(init): Cleanup the unknown shell message

Have make a small change to the message that is printed when an unknow
shell is used. This correct the placement of the trailing `"` so that
the two training new lines are correctly printed and updates the list of
supported shells.

* refactor(init): consolidate unknown shell errors

Have consolidated the two unknown shell errors

* refactor(init): Quote the shell name in the output

Quote the shell name in the script and combined the shell_name and
shell_basename to simplify the code a little.
2021-03-25 15:08:28 -05:00
David Knaack ba40ad5ce6
chore(clippy): fix new lints (#2507) 2021-03-25 16:03:19 -04:00
Chris Rose aa7a8056bb
fix: Add a missing ' ' to the end of the python prompt (#2248)
Co-authored-by: Chris Rose <offline@offby1.net>
2021-03-24 10:41:08 -05:00
Andy Freeland 3513aae3ed
fix(shell): Support conditional format strings for `$indicator` (#2489)
Previously attempting to use conditional format strings with
`$indicator` would never display an indicator, e.g.:

```toml
[shell]
fish_indicator = ""
bash_indicator = "B "
format = "($indicator )"
disabled = false
```

This would always display an empty string.

Fixes #2474.
2021-03-23 17:20:29 -04:00