Commit Graph

490 Commits

Author SHA1 Message Date
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
Aman Kumar Sinha 9f2f5293e3
docs: fix custom commands example (#3129) 2021-10-06 18:31:26 -05:00
Ian Wahbe dfb1208787
feat: Add pulumi module (#3055) 2021-10-05 18:27:25 -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
Onigiri e85a68578c
docs(config): Add missing double quotes to default value strings (#2981) 2021-10-02 16:03:18 -04:00
Kevin Song 35f6206593
docs: Add missing modules to $all in config docs (#3075)
* Add cobol to $all in config docs

* Undo whitespace changes

* Add singluarity/rlang, move lua to correct location
2021-09-17 16:16:36 -05:00
Dave Powers 913dc3af2a
docs: fix grammar in config README (#3069) 2021-09-17 11:46:42 -04: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
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
Kid 494b6eb40f
docs(config): change spelling of some words (#2855)
* docs(config): correct spelling

* Add more reference links

* Fix blank line

* Fix bad merge
2021-09-01 20:34:41 +02:00
machupicchubeta f265f12eb2
docs: Correct the "VLang" configuration example (#3019)
* Correct the "VLang" configuration example

This commit is a document correction only; to avoid the configuration error.
The documents to be corrected are "docs/[lang]/README.md".

With a config key of `[v]` on macOS, it has the following error.
```
[WARN] - (starship::configs::starship_root): Unknown config key 'v'
```
I think it might be the error in other OS as well.

In the other document "docs/[lang]/presets/README.md", the config key is `[vlang]`.

* Touch only the English docs

The changes to the translated pages will be done automatically.
2021-08-29 17:26:41 +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
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
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
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
MeztliRA ed60b69bcc
docs: fix shlvl module's symbol (#2911) 2021-07-26 11:02:47 -04:00
Shakil Bijabhai 80c5eca2ee
docs: fix typo for python in README.md (#2909) 2021-07-22 15:20:55 -04:00
Alex L cacb0a685f
docs: update git_commit default format (#2898) 2021-07-17 16:55:07 -04: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
Matan Kushner e1fc137dc9
docs: add the terminator to the tip in env variable 2021-07-14 12:27:45 -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
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 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
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
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
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
Thomas O'Donnell b023e60b76
docs(character): Add warning about missing feature (#2754)
* docs(character): Add warning about missing feature

Have added some additional docs to indicate that `vicmd_symbol` doesn't
work for bash's vi mode.

* Update docs/config/README.md
2021-05-31 18:05:53 +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
Thomas O'Donnell eb01e1927d
docs(python): Add additional python_binary example (#2728)
Have added an additional example for the `python_binary` option to show
how to display the version of python from inside a local virtual
environment.
2021-05-17 08:43:16 +02:00
Carl-Louis Van Brandt 69a754573d
feat(aws): add temporary credentials countdown (#2464) 2021-05-12 20:43:46 -04: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
Dario Vladović c4f977c48d
feat(vlang): support `vpkg` (#2686) 2021-05-07 10:22:18 -04: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
Jonathan Feinberg cb681cd0ae
docs: fix raw string format (#2677) 2021-05-02 09:54:32 +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
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
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
Yanick Champoux 00e64ecb74
docs fix typo it's => its (#2664) 2021-04-29 08:41:10 -04:00
Kid adaf464bc5
docs(config): add links to software (#2645)
* docs(config): add links to software

* Add links to package managers

* 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-04-26 19:57:41 +02:00
David Knaack e5017e0155
docs: remove reference to print-config for now (#2651) 2021-04-26 19:54:19 +02:00
Dario Vladović fabf9c6fb7
docs(python): fix incorrect `detect_extensions` defaults (#2632) 2021-04-23 08:30:48 +02:00
Dario Vladović adbdca63f0
docs(dart): use double quotes for consistency (#2633) 2021-04-23 08:30:23 +02: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
Thomas O'Donnell 3643cf63be
docs: Document the `command_timeout` option (#2604)
Have added documentation for the top level `command_timeout` option.
2021-04-18 19:32:00 +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
TAKAHASHI Shuuji e0f181d2c7
docs(gcloud): Replace the section title "Gcloud" with "gcloud" (#2597)
* docs: Replace the section title "Gcloud" with "gcloud"

* Update README.md
2021-04-17 13:43:41 +02:00
Denny Schäfer 49b23559a1
docs: fix tables Markdown format (#2554) 2021-04-16 22:51:37 +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ć 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
Chris Rose 6817e7f698
feat: add version format configuration (#2499) 2021-04-08 18:37:54 -04: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
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ć 28f7416a6e
docs: fix typo `moudle` -> `module` (#2504)
Co-authored-by: Erik P. Hansen <eph@erikphansen.com>
2021-03-25 09:46:46 -04:00
Dario Vladović 4375517d9a
docs: format markdown (#2493)
Remove trailing whitespace and extra newlines.
2021-03-24 21:44:52 +01:00
Dario Vladović 787702a179
docs: format configuration tables (#2494)
* docs: lowercase module names

* docs: format truncation length description

* docs: format git `HEAD` occurrences

* docs: format `SHLVL` environment var occurrences

* docs(node): fix incorrect manifest filename
2021-03-24 18:19:51 +01: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
Eyal Cherevatzki 612cc7d27b
refactor(dotnet): ".NET" instead of "•NET" (#2471)
* refactor(dotnet): ".NET" instead of "•NET"

"•NET" looks quite weird, especially since the official writing is ".NET".

* revert(docs): translated docs

Co-authored-by: Eyal Cherevatzki <eyal@hyperguest.com>
2021-03-18 18:46:54 +01:00
Melroy van den Berg c91b293c9d
fix(cmake): Change cmake symbol to unicode triangle (#2456) 2021-03-15 11:27:54 +01:00
Beni Ben zikry dd5c62791c
feat(scala): Add scala module (#2409)
* Add support for scala ( w/o sbt )

* Add scala description

* Change scala color to bold red

* update scala extensions in README

* failed lint

* cr changes ( regex, simplify parsing, imports )

* Scala readme punctuation

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

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2021-03-14 20:37:00 +01:00
nils måsén e5cdd9c1b3
feat(aws): add support for getting profile from awsu (#2451) 2021-03-13 09:35:50 +01:00
Eric Nielsen fb6cefa4b5
style(aws): Add spacing between profile and region (#2417)
and also after the symbol when using the Nerd font glyph.
2021-03-06 20:47:06 +01: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
Artur Daschevici 5a29765f81
docs: Clarify wording on add_newline option (#2308)
* docs: Clarify wording on add_newline option

* docs: Replace new line with blank line
2021-02-23 18:50:36 +01:00
whi-tw 4d3a4f230d
fix(nodejs): Change symbol to nerd-font (#1649)
The unicode hexagon symbol does not actually fit into a single column with a
fixed-width font.  does. As starship requires a nerd font as a prerequisite, 
it's safe to assume that this symbol is available.
Symbol link: https://www.nerdfonts.com/cheat-sheet?set=nf-mdi-nodejs

In the documentation, I've left the '⬢' symbols in '#### Text Group' as
they are, as they will continue displaying correctly in a browser
without a nerd font available. I feel like readability is more important
than consistency with the new nodejs symbol, especially as this
documentation section does not actually refer to nodejs, rather it's
just a symbol.

As `⬢` has been replaced, use `⌘` instead in documentation to avoid
any possible confusion
2021-02-22 14:10:36 -06:00
Thomas O'Donnell 0083e28827
feat(helm): Configure when the module is shown (#2352)
This makes it possible to configure when the helm module is shown based
on the contents of a directory.
2021-02-21 19:57:23 +01:00
Thomas O'Donnell 64288c2e04
feat(java): Configure when the module is shown (#2353)
This makes it possible to configure when the java module is shown
based on the contents of a directory.
2021-02-21 19:57:09 +01:00
Thomas O'Donnell c0a209f27c
feat(julia): Configure when the module is shown (#2358)
This makes it possible to configure when the julia module is shown
based on the contents of a directory.
2021-02-21 19:56:55 +01:00
Thomas O'Donnell 1a6c625521
feat(kotlin): Configure when the module is shown (#2359)
This makes it possible to configure when the kotlin module is shown
based on the contents of a directory.
2021-02-21 19:56:48 +01:00
Shu Kutsuzawa fe6f9eeb4d
feat(purescript): Configure when the module is shown (#2357)
This makes it possible to configure when the purescript module is shown
based on the contents of a directory. This should make it possible to
be a lot more granular when configuring the module.
2021-02-21 19:53:10 +01:00
Shu Kutsuzawa efb82454f2
feat(php): Configure when the module is shown (#2356)
This makes it possible to configure when the php module is shown
based on the contents of a directory. This should make it possible to
be a lot more granular when configuring the module.
2021-02-21 19:52:19 +01:00
Shu Kutsuzawa 51f752f6b0
feat(perl): Configure when the module is shown (#2355)
This makes it possible to configure when the perl module is shown
based on the contents of a directory. This should make it possible to
be a lot more granular when configuring the module.
2021-02-21 19:51:36 +01:00
Shu Kutsuzawa e73581ddf0
feat(ocaml): Configure when the module is shown (#2354)
This makes it possible to configure when the ocaml module is shown
based on the contents of a directory. This should make it possible to
be a lot more granular when configuring the module.
2021-02-21 19:50:40 +01:00
David Knaack 509767adc0
feat(swift): Configure when the module is shown (#2349)
This makes it possible to configure when the swift module is shown
based on the contents of a directory.
2021-02-21 18:01:31 +01:00
David Knaack a499f30157
feat(rust): Configure when the module is shown (#2350)
This makes it possible to configure when the rust module is shown
based on the contents of a directory.
2021-02-21 18:01:17 +01:00
David Knaack 9ba82e8d92
feat(ruby): Configure when the module is shown (#2351)
This makes it possible to configure when the ruby module is shown
based on the contents of a directory.
2021-02-21 18:01:01 +01:00
Shu Kutsuzawa c0a0e85556
feat(nodejs): Configure when the module is shown (#2348)
This makes it possible to configure when the nodejs module is shown
based on the contents of a directory. This should make it possible to
be a lot more granular when configuring the module.
2021-02-21 13:22:40 +01:00
Shu Kutsuzawa 4651060999
feat(nim): Configure when the module is shown (#2347)
This makes it possible to configure when the nim module is shown
based on the contents of a directory. This should make it possible to
be a lot more granular when configuring the module.
2021-02-21 13:21:20 +01:00
Thomas O'Donnell 873a005c42
feat(erlang): Configure when the module is shown (#2346)
* feat(erlang): Configure when the module is shown

This makes it possible to configure when the erlang module is shown
based on the contents of a directory. This should make it possible to
be a lot more granular when configuring the module.

* Update docs/config/README.md

Co-authored-by: Shu Kutsuzawa <cappyzawa@gmail.com>

Co-authored-by: Shu Kutsuzawa <cappyzawa@gmail.com>
2021-02-21 13:20:14 +01:00
Thomas O'Donnell eaf9868c11
docs(config): Clarify the changing starship config (#2339)
Have clarified changing the starship config file using the
`STARSHIP_CONFIG` env var.
2021-02-21 10:02:41 +01:00
Thomas O'Donnell 71b6fc1777
feat(elm): Configure when the module is shown (#2341)
This makes it possible to configure when the elm module is shown
based on the contents of a directory. This should make it possible to
be a lot more granular when configuring the module.
2021-02-20 18:33:00 +01:00
Thomas O'Donnell 9313e90773
feat(elixir): Configure when module is shown (#2340)
This makes it possible to configure when the elixir module is shown
based on the contents of a directory. This should make it possible to be
a lot more granular when configuring the module.
2021-02-20 18:32:04 +01:00
Mikołaj Rosowski 37d3425d21
feat: create shell module (#2329)
* Add the shell module

This module allows to quickly identify which shell is currently used, in case someone frequently switches between them.

* Updated documentation with shell module.

Co-authored-by: mro <mro@fedorabox.localdomain>
2021-02-20 15:40:49 +01:00
Thomas O'Donnell d52edaa661
feat(dotnet): Configure when module is shown (#2327)
This makes it possible to configure when the dotnet module is shown
based on the contents of a directory. This should make it possible to be
a lot more granular when configuring the module.
2021-02-20 15:38:03 +01:00
Shu Kutsuzawa 5e93160456
feat(lua): Configure when the module is shown (#2326)
This makes it possible to configure when the lua module is shown
based on the contents of a directory. This should make it possible to
be a lot more granular when configuring the module.
2021-02-17 19:03:09 +01:00
Shu Kutsuzawa 97fbfffd7e
feat(golang): Configure when the module is shown (#2325)
This makes it possible to configure when the golang module is shown
based on the contents of a directory. This should make it possible to
be a lot more granular when configuring the module.
2021-02-17 18:58:21 +01:00
Shu Kutsuzawa 82c7fd6742
feat(terraform): Configure when the module is shown (#2324)
This makes it possible to configure when the terraform module is shown
based on the contents of a directory. This should make it possible to
be a lot more granular when configuring the module.
2021-02-17 18:57:40 +01:00
Thomas O'Donnell e8f463bb57
feat(docker_context): Configure when module is shown (#2315)
* feat(docker_context): Configure when module is shown

This makes it possible to configure when the docker_context module is
shown based on the contents of a directory. This should make it possible
to be a lot more granular when configuring the module.

* 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-02-16 20:05:43 +01:00
David Knaack 856610d53b
feat(vagrant): Configure when the module is shown (#2314)
* feat(vagrant): Configure when the module is shown

This makes it possible to configure when the vagrant module is shown based on the contents of a directory.

* fix documentation

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

Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2021-02-15 20:21:21 +01:00
Thomas O'Donnell d0951db35a
feat(dart): Configure when the module is shown (#2312)
* feat(dart): Configure when the module is shown

This makes it possible to configure when the dart module is shown based
on the contents of a directory. This should make it possible to be a lot
more granular when configuring the module.

* docs(dart): add missing detected files

* removed invalid comment
2021-02-14 22:21:52 +01:00
David Knaack d4843545aa
feat(zig): Configure when the module is shown (#2311)
* feat(zig): Configure when the module is shown

* remove outdated comment
2021-02-14 22:21:44 +01:00
Thomas O'Donnell 81d6f6aa98
feat(crystal): Configure when the module is shown (#2310)
* feat(crystal): Configure when the module is shown

This makes it possible to configure when the crystal module is shown
based on the contents of a directory. This should make it possible to
be a lot more granular when configuring the module.

* 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-02-14 18:14:55 +01:00
Thomas O'Donnell 47a769cdf8
feat(cmake): Configure when the module is shown (#2280)
This makes it possible to configure when the cmake module is shown
based on the contents of a directory. This should make it possible to
be a lot more granular when configuring the module.
2021-02-13 11:38:47 +01:00
Benjamin Fox 20d845f9b3
refactor(directory): Introduce `logical-path` argument which allows a shell to explicitly specify both a logical and physical filesystem path (#2104)
* refactor(directory): Introduce `logical-path` argument which allows a shell to explicitly specify both a logical and physical filesystem path

Fix `directory::module` to consume both path and logical-path (if provided).  The "logical" path is preferred when rendering the "display path", while the "physical" path is used to resolve the "read only" flag. Repo- and home-directory contraction behavior is maintained, based on the logical path if it is set, or the physical path if it is not.

The custom "get_current_dir" logic has been removed entirely, and the `directory` module now relies on `context.current_dir` / `context.logical_dir` entirely.

Changes have been made to `init/starship.ps1` to work with this new flag:
- Calculate and pass "physical" and "logical" paths explicitly (as other shells do not pass `--logical-path` that they fall back to rendering the physical path)
- Moved the "powershell provider prefix" cleanup code to the PowerShell script - this code _should_ now support any kind of powershell path prefix.

* fix(powershell): Fix an issue with trailing backslashes on file paths causing command line parsing issues.

This is a bit of a footgun!
The work-around chosen is to append a trailing space when a path string ends with a backslash, and then trim any extra whitespace away in the Context constructor.
Other alternatives considered and rejected:
1. Always trim trailing backslashes as the filesystem generally doesn't need them.
2. Escape trailing backslashes with another backslash. This proved complex as PS only quotes string args when the string includes some whitespace, and other backslashes within the string apparently don't need to be escaped.

* fix(powershell): Use Invoke-Native pattern for safely invoking native executables with strings which may contain characters which need to be escaped carefully.

* fix(context): Remove superfluous argument trims

These were in place to clean up extra whitespace sometimes injected by starship.ps1::prompt, and are no longer required with the new Invoke-Native helper in place.

* refactor(directory): Clean up the semantics of `logical_dir` defaulting it to `current_dir` but overridable by the `--logical-dir` flag.

- Restore `use_logical_path` config flag.
- Always attempt to contract repo paths from the `current_dir`.

* fix(directory) :Use logical_dir for contracting the home directory

This keeps the two calls to contract_path in sync.

* fix(directory): Remove test script

* refactor(directory): Convert current_dir to canonical filesystem path when use_logical_path = false

- This requires some clean-up to remove the extended-path prefix on Windows
- The configured logical_dir is ignored entirely in this mode - we calculate a new logical_dir by cleaning up the physical_dir path for display.
- Test coverage

* fix(directory): Use AsRef style for passing Path arguments

* fix(directory): Strip the windows extended-path prefix from the display string later in the render process

* fix(docs): Update docs/config/README.md for use_logical_path

* refactor(context): Populate `current_dir` from `--path` or `std::env::current_dir`, populate `logical_dir` from `--logical-path` or the `PWD` env var

- `current_dir` is always canonicalized
- On Windows, `current_dir` will have an extended-path prefix
- `logical_dir` is now always set
- `directory::module` now just selects between `current_dir` and `logical_dir` when picking which path to render
- Test coverage

* fix(directory): Fix path comparison operations in directory to ignore differences between path prefixes

- Added PathExt extension trait which adds `normalised_equals`, `normalised_starts_with` and `without_prefix`

* fix(path): Add test coverage for PathExt on *nix

* fix(directory): Test coverage for `contract_repo_path`, `contract_path` with variations of verbatim and non-verbatim paths

* fix(directory): Update path-slash to latest

This fixes the issue with the trailing character of some Windows paths being truncated, e.g. `\\server\share` and `C:`

* fix(powershell): Improve UTF8 output handling, argument encoding

- Use `ProcessStartInfo` to launch native executable, replacing manual UTF8 output encoding handling
- If we detect we're on PWSH6+ use the new `System.Diagnostics.ProcessStartInfo.ArgumentList` parameter, otherwise manually escape the argument string
- Move `Get-Cwd` and `Invoke-Native` into the prompt function scope so that they don't leak into the user's shell scope

* fix(path): Make PathExt methods no-ops on *nix

* fix(path): Cargo fmt

* fix(powershell): Remove typo ';'. Fix variable assignment lint.
2021-02-08 15:14:59 +01:00
Thomas O'Donnell da4bd401c4
feat(python): Configure when the module is shown (#2264)
This makes it possible to configure when the python module is shown
based on the contents of a directory. This should make it possible to
be a lot more granular when configuring the module.

This includes a breaking change since we are removing the
`scan_for_pyfiles` configuration option in favour of setting the
`detect_extensions` to an empty array.
2021-02-07 22:18:52 +01:00
Dan Tsekhanskiy 2bc8a7172d
docs(status): Remove status_ prefix from status module variables (#2260)
* Remove status_ prefix from status module variables

* Revert "Remove status_ prefix from status module variables"

This reverts commit f4c6e9ced3040ef2939189afe7ff8bd08d6fae78.

* docs: Remove status_ prefix from status module variables
2021-02-03 18:52:15 +01:00
David Knaack 22dc8b842e
feat: add support for elvish shell (#1725)
* feat: add support for elvish shell

* improve doc

* elvish 0.15 is out

* fix example init

* update systax for 0.15 stable

* udpate second init example too

* remove warning from swift module

* add warning to status module docs

* prefix elvish version with v
2021-02-02 12:59:55 +01:00
Furkan Türkal 9e21e3cf5f
feat(vagrant): Add support for Vagrant (#1812)
Signed-off-by: Dentrax <furkan.turkal@hotmail.com>
Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>

Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2021-01-30 12:05:16 +01:00
Thomas O'Donnell 762ad12698
test(docker_context): Add basic tests to module (#2205)
* test(docker_context): Add basic tests to module

This adds some basic tests to the docker_context module.

* PR suggestion
2021-01-26 22:46:17 +01:00
matoruru b1efe30bbe
docs(status): fix the format string to match the default (#2211) 2021-01-26 22:42:41 +01:00
Rodrigo Suárez ca36d15acd
feat(directory): Add home directory symbol (#2198)
* feat(directory): Add home directory symbol

* Replace HOME_SYMBOL constant as a config variable
2021-01-24 22:50:37 +01:00
Thomas O'Donnell a67bf5b34f
docs(terraform): Make version perf issue obvious (#2107)
This intends to make the performance issue with the terraform version
more obvious.
2021-01-23 15:17:51 +01:00
Moritz Vetter 4e7f73da50
perf(zig): Lazy eval zig (#2187)
* perf(zig): evaluate version lazily

* fix(zig): update format string; update tests

* refact(zig): remove redundant clone and put everything to do with version eval into match statement

* tiny optimization

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

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2021-01-22 18:08:36 +01:00
Moritz Vetter 212dbc4e6b
perf(ocaml): evaluate version lazily; adjust format string; update test (#2188)
Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-22 18:08:04 +01:00
Moritz Vetter 16b8cbfdb8
perf(perl): Lazy eval perl (#2189)
* perf(perl): evaluate version lazily

* fix(perl): update format string; update tests

* refact(perl): run rustfmt

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-22 18:07:03 +01:00
Moritz Vetter d10a83ce6b
perf(php): Lazy eval php (#2190)
* perf(php): evaluate version lazily

* fix(php): update format string; update tests

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-22 18:03:18 +01:00
Moritz Vetter 60be1e9540
Perf(purescript): Lazy eval purescript (#2191)
* perf(purescript): evaluate version lazily

* fix(purescript): update format string; update tests

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-22 18:01:54 +01:00
Moritz Vetter 00afc82049
perf(kotlin): Lazy eval kotlin (#2186)
* perf(kotlin): evaluate version lazily

* fix(kotlin): update format string; update tests

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-21 23:01:30 +01:00
Moritz Vetter 98b89b9432
perf(lua): Lazy eval lua (#2185)
* perf(lua): evaluate version lazily

* fix(lua): update format string

* test(lua): update tests

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-21 23:00:12 +01:00
Moritz Vetter b5fd517972
perf(nodejs): evaluate nodejs format string lazily (#2160)
* fix(nodejs): update format string

* test(nodejs): adjust tests to new format strings

* fix(nodejs): use once_cell's Lazy to implement hassleless lazy execution

* chore(nodejs): run rustfmt

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-20 19:03:48 +01:00
David Knaack 8302a3ccb4
perf(custom): evaluate command lazily (#2173) 2021-01-20 19:01:49 +01:00
David Knaack bb160d9207
perf(elixir): evaluate version lazily (#2172) 2021-01-20 18:59:21 +01:00
Moritz Vetter 2532251a13
perf(dart): Lazy eval dart (#2166)
* perf(dart): evaluate version lazily

* fix(dart): update format string

* fix: use suggested format string

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-20 18:56:18 +01:00
Moritz Vetter 83e0432a75
perf(java): Lazy eval java (#2168)
* perf(java): evaluate version lazily

* fix(java): update format string

* fix: use suggested format string

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-20 18:51:30 +01:00
Moritz Vetter b065758b1c
perf(elm): Lazy eval elm (#2167)
* perf(elm): evaluate version lazily

* fix(elm): update format string

* fix: use suggested format string

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-20 18:49:26 +01:00
Moritz Vetter 527ffbaede
fix: Adjust default format strings (#2165)
* fix(dotnet): update dotnet format string

* fix(dotnet): update erlang format string

* fix(dotnet): update golang format string

* fix(dotnet): update helm format string

* fix(dotnet): update julia format string

* fix(dotnet): update nim format string

* fix(dotnet): update ruby format string

* fix(dotnet): update rust format string

* test: update formatted strings in unit tests

* Use suggested format strings

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

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2021-01-20 18:46:26 +01:00
Moritz Vetter e437a463ac
perf(python): Lazy eval of python version command (#2158)
* perf(python): evaluate version lazily

* fix(python): update format string

* fix: use suggested format strings

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

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2021-01-20 18:42:55 +01:00
Moritz Vetter 2391a2863c
perf: evaluate swift version lazily (#2159)
* perf(swift): evaluate version lazily

* fix(swift): update format string

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2021-01-18 22:42:28 -06:00
Thomas O'Donnell 12494da38a
fix(cmake): Fix spacing with missing variable (#2135)
This fixes the additional space when the `version` variable can't be
populated.
2021-01-16 13:27:02 +01:00
David Knaack 0faa05628e
docs: highlight powershell in vuepress (#2147) 2021-01-14 15:48:06 -05:00
Thomas O'Donnell f640db87a4
perf(crystal): Lazily evaluate version command (#2129)
* perf(crystal): Lazily evaluate version command

This updates the module to lazily execute the `crystal --version`
command only when the `version` variable is used in the format string.

* perf(crystal): Update format string

Update format string to handle the `$version` variable not being set.
2021-01-13 18:35:44 +01:00
Ben Iofel 0a9db856de
fix(docker_context): enable if either yml or yaml is found (#2053)
* fix(docker_context): enable if either yml or yaml is found

* Update docs
2021-01-11 17:38:58 +01:00
Matan Kushner be11c73507
docs: fix custom containers to work with Crowdin
Fixes #2063
2021-01-07 17:35:14 -05:00
Sam Kvale f5a6c4cdbd
docs: update package default format to replace /via/is (#2067)
https://github.com/starship/starship/blob/master/src/configs/package.rs#L17
2021-01-04 11:56:25 -05:00
Hugues Morisset cfff77043e
feat(status): Convert known status code to their meaning (#1948)
User is able to choose if their want to display the meaning of known status code in place of number.
2021-01-02 21:09:13 -06:00
David Knaack 6de4bb01f4
feat(battery): make module behaviour more obvious (#1950) 2021-01-01 12:16:55 +01:00
Nicola Corti 208251adef
feat(kotlin): Add the kotlin module (#2026)
Add a module to show the currently installed Kotlin version if a
.kt/.kts file is found in the current folder
2020-12-26 15:26:50 +01:00
花蛄 4f51ef8db1
feat(package): Meson package support (#2001)
* Add package version support for Meson meson.build.

* Update docs with Meson package version support.
2020-12-19 14:17:34 +01:00
adrian5 9a2355c164
docs: fix typo in config (#2008) 2020-12-18 12:24:48 -05:00
Daniel Beckwith 1296632ff4
feat(shlvl): Add `repeat` option (#1995) 2020-12-14 15:40:21 -05:00
James Ross f311c3cbf5
docs: Correct dotnet module default format to match code (#1983) 2020-12-11 12:20:39 -06: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
yangsheng6810 a72977f7d4
feat(username): Try harder to guess if inside ssh (#1964)
* feat: Try harder to guess if inside ssh

* Add test for SSH_CLIENT

* Update documentation on checking ssh connection

* 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>
2020-12-06 22:15:20 +01:00
Kesavan Yogeswaran 70dcd33aa2
docs(conda): Fix default format in Conda module's config doc (#1965)
* docs: Fix default format string for Conda module

 #### Issues Addressed

 The default `format` string for the Conda module starts with "via", as
 seen [here](2e763b5e7c/src/configs/conda.rs (L19)).
 However, this is not reflected in the config docs.

 Many similar modules include "via" in their default format string so I
 assume including it is the intended behavior, and that the doc should
 be updated.

 #### Summary of Changes

 Correct the default `format` string for the Conda module in the config
 docs.

* Revert changes to i18n files

Revert changes to i18n files, as these must be handled by Crowdin
2020-12-06 21:02:15 +01:00
quentm74 2e763b5e7c
feat: Move cmd_duration after custom module (#1681) 2020-12-05 19:57:22 +01:00
t-mangoe 89588a7391
feat(nodejs): check node engines version in package.json (#1847)
* check node engines version in package.json

* fix code, following review.
2020-12-05 12:25:48 +01:00
Thomas O'Donnell cf8a6d0738
feat(python): Smarter python binary usage (#1947)
Update the python module to try multiple python binaries when
determining the version. With the new logic if starship doesn't find
`python` on the `PATH`, which is the default for some Linux Distros, it
will fallback to `python3` and then `python2`.
2020-11-30 13:14:18 -06:00
Zane Shelby 389e006c00
feat(java): Show Java module for Clojure projects (#966) 2020-11-30 13:50:56 +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
Giorgio Gallo 045ee17817
docs: Alphabetic sorting of config subsections (#1877) 2020-11-14 19:41:58 +01:00
Adham ac88301294
feat(terraform): Add hcl extension support to Terraform module (#1875)
* Add hcl file extension to terraform module

Signed-off-by: adhaamehab <adhaamehab.me@gmail.com>

* Update docs

Signed-off-by: adhaamehab <adhaamehab.me@gmail.com>
2020-11-14 18:33:21 +01:00
juno suárez 597fd40812
docs(cmd_duration): Document cmd_duration notifications (#1831)
* docs: add options for cmd_duration notifications

Added in #1019

* 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>
2020-11-04 18:53:51 +01:00
Shu Kutsuzawa c6d25a6a38
feat(lua): Add a Lua module (#1815)
* feat: add lua module

* docs: add lua module

* fix: lua version test

* feat: lua module can be detected if the current dir contains a "lua" dir

* feat: enable to use luajit

* fix: improve regex

* fix based on https://github.com/starship/starship/pull/1815#discussion_r510932742

* fix based on https://github.com/starship/starship/pull/1815#discussion_r511362581

* fix based on https://github.com/starship/starship/pull/1815#discussion_r510941252
2020-10-27 19:05:20 +01:00
Christoph Schlosser 89fc93d1f9
feat(cmake): Add CMakeCache.txt detection to CMake module (#1795)
* Add CMakeCache.txt to cmake module

* Remove trailing whitespace

* Apply fixes by @andytom

* Add CMakeCache.txt to docs

* Revert documentation for languages other than en
2020-10-25 19:10:42 +01:00
Mauricio Teixeira eec961caaf
feat(openstack): Add module for OpenStack (#1664)
* first (crude) attempt to implement the openstack module

* Attempt to follow OpenStack standards for clouds.yaml location

* fmt

* provide unittest

* add documentation

* fix fmt

* fix clippy

* fix clippy

* fix fmt

* fix small nitpicks

* expand openstack explanation

* load config file using find_map

* fix fmt

* add test for valid config, plus fix test for invalid config

* fix fmt

* re-add forgotten comment
2020-10-24 11:46:43 +02:00
Miguel Ángel Melón Pérez ea9f803018
feat(git_commit): add git tag to module (#950) 2020-10-23 11:49:19 -04:00
Jeremy Hilliker 3287e48b65
docs(memory): Remove removed options from Memory example (#1800)
Remove the following options (unsupported since ec76faf & v0.45.0):
[memory_usage]
show_percentage = true
show_swap = true
separator = "/"

Signed-off-by: Jeremy Hilliker <dev.nospam@jeremyh.com>
2020-10-17 09:55:52 +02:00
Matan Kushner 783eb3373d
fix: replace emoji for cmake and erlang (#1787) 2020-10-13 18:01:35 -04:00
Thomas O'Donnell 9044f9e14c
docs: Update defaults in config docs (#1759)
Have updated some of the config docs to correct the git_status default
that was incorrect. Have also taken the time to switch some of the
format strings to use toml literal strings rather than normal strings to
simplify the escape strings.
2020-10-12 00:10:39 -04:00
Thomas O'Donnell 140009994d
docs(python): Update the python_binary option (#1731)
* docs(python): Update the python_binary option

Have updated the documentation to make the `python_binary` option a bit
more prominent, since this is becoming a more requested requirement now
that more and more systems don't have a default `python` command.

* Correct order of python options
2020-10-06 02:09:06 -05:00
Jeremy Hilliker 1673d565f4
feat(directory): add ellipsis to truncated paths (#1563)
Adds ellipsis in front of truncated paths: …/
Configurable through new config option: directory.truncation_symbol
Fixes #1162, #1626
2020-10-03 11:25:21 -05:00
Matan Kushner ce73f6347f
docs(directory): fix $read_only variable names
Fixes #1706
2020-09-30 18:40:25 -04:00
Érico Nogueira Rolim ae55697dfb
docs: Remove newline from beginning of example format config. (#1693)
Having a newline there means that an empty newline is printed everytime
the user runs a command or presses Enter, which for short commands
and/or small terminal windows can noticeably decrease the information
density.
2020-09-29 23:39:20 -04: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
Matan Kushner 3c668e6e6a
doc: small doc fixups 2020-09-28 12:38:14 -04:00
Thomas O'Donnell 7b09c86b0f
docs(git_status): Update git_status module docs (#1667)
* docs: Update git_status module docs

Have updated the configuration docs for the `git_status` to remove a
non-existing option and to add an example for how to achieve the same
effect as with the new format strings.

* Add git_status changes to migration guide

Have added the change to the sync count to the migration guide. I also
corrected a few typos in the configuration.
2020-09-26 19:15:52 +02:00
Jan Katins ffb1345052
feat(status): add the status module (#1651)
* add the exit code module

this allows to display more precisely the last command exit code
and to configure starship to not change the last charcter of the
prompt even in case of failure. It is disabled by default, because
it seems a bit redundant with the character module in its default
configuration.

* rename exit_code module to status

* Enforce a default disabled=true 

In the outer places, we only check for the disabled flag in the config toml file, only when this is loaded into the real config struct, we see the default. And if the default is true, we have to abort at that place. For status and hg_branch that wasn't so. I also commented the rest

* fix spaces in markdown table for status module

* Add a tip that status module is disabled by default

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

* Remove unrelated changes for default disabled=true

Co-authored-by: Gaëtan Lehmann <gaetan.lehmann@gmail.com>
Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2020-09-26 00:04:51 +02:00
Tilmann Meyer a245d54cdb
fix(git-state): Fix discrepancy between v0.44.0 and master (#1672) 2020-09-21 15:17:06 -04:00
Thomas O'Donnell bb324834a5
fix: restore the `pyenv_prefix` option to python (#1668)
Have restored the `pyenv_prefix` option to the python module. This is
added as a new variable that will only be shown if `pyenv` is being used
to determine the version of python that is being used.
2020-09-21 11:48:26 -04:00
Matan Kushner d3100c5c82
fix: use suffixes for modules before directory (#1645)
Previously, all modules would have prefixes, which lead to the first
module having a dangling prefix. This change ensures that the first
few modules would instead have suffixes so that we don't start or
end with a prefix or suffix.
2020-09-08 12:09:21 -04: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
Matan Kushner 1cd4f12bb4
Revert "fix: restore add_newline configuration (#1592)" (#1596) 2020-08-17 12:30:01 -04:00
Matan Kushner 1652c0bdb1
fix: restore add_newline configuration (#1592) 2020-08-16 23:33:40 -04:00
Emanuele Aina 5ce4322a2c
docs: Drop inexistent "number" variable from hostname section (#1586)
The hostname module does not provide any "number" variable, its presence
in the documentation is likely due to some copy&paste from the jobs
module section, so let's drop it.

Signed-off-by: Emanuele Aina <em@nerd.ocracy.org>
2020-08-15 11:02:20 +02:00
Daniel A. White 0be9ffc0a1
feat(shlvl): Add shlvl module (#1385)
* initial commit of support for shlvl

* documentation for shlvl

* use a symbol instead

* test coverage for shlvl

* actually disable when the config says to

* fix docs

* tweak defaults some

* refactor from pr comments

* redisable

* return early to avoid indenting

* make default suffix empty space

* fixing tests after suffix change

* updating docs for format

* making shlvl compatible with formatting

* adding variables table for shlvl

* removing extra line

* doc clarity
2020-08-05 18:30:01 +02:00
Stéphane Benoit ef55042f2e
feat(perl): Added perl version module (#1382)
Adds a module for perl support.
2020-08-04 11:22:44 -05:00
Takahiro Tsuruda c5f2eedf07
feat: Add gcloud module (#1493)
* feat(gcloud): Add document of gcloud module

Signed-off-by: dulltz <isrgnoe@gmail.com>

* feat(gcloud): Add gcloud module

Signed-off-by: dulltz <isrgnoe@gmail.com>

* feat(gcloud): Add test for gcloud module

Signed-off-by: dulltz <isrgnoe@gmail.com>

* Apply the comment

https://github.com/starship/starship/pull/1493\#discussion_r456965413
Signed-off-by: dulltz <isrgnoe@gmail.com>
2020-08-03 23:30:20 +02:00
Thomas O'Donnell b845abe006
docs: Update example config to remove old var (#1546)
Have updated the example toml config to remove an old var and replace it
with the updated replacement.
2020-08-02 19:16:25 +02:00
Steve Smith b14be4dfb1
feat(package): Add Maven pom.xml version support (#1511)
* Add gitignore for Emacs backup files.

* Add package version support for Maven pom.xml.

* Update docs with Maven package version support.

* Fix for clippy.
2020-07-31 09:54:03 +02:00
Jason Wang acefbc523f
feat(conda): add ignore_base option (#1539)
* Add ignore_base to conda module

* Add ignore_base to conda module in English docs

* `ignore_base` defaults to `true`
2020-07-30 18:57:15 +02:00
Dario Vladović 84f049f836
feat(dart): add Dart module (#1392) 2020-07-29 11:38:23 -04:00
Dario Vladović feb4124cac
feat(swift): add Swift module (#1261) 2020-07-29 11:36:49 -04:00
Simão Mata 1acce65462
feat(package): Add support for Helm charts (#1525)
Signed-off-by: Simão Mata <sm@0io.eu>
2020-07-29 14:06:47 +02:00
Batuhan Apaydın 03d75eb419
feat(helm): Add Helm module (#1463)
Signed-off-by: Furkan <furkan.turkal@hotmail.com>

Co-authored-by: Furkan <furkan.turkal@hotmail.com>
2020-07-17 09:51:25 +02:00
Alexey Chernyshov 57c39437bc
feat(directory): Show lock symbol if current directory is read only (#1298)
Add feature to display icon if current directory is read-only.
2020-07-13 16:55:42 -05:00
Tilmann Meyer bd68970fab
feat(cmake): Add CMake module (#1456)
* feat: CMake module

* docs: Document symbol variable
2020-07-09 21:40:33 +02:00
Zhenhui Xie ec76fafff0
feat: refactor modules to use format strings (#1374) 2020-07-07 18:45:32 -04:00
Matan Kushner 428a78ebb5
fix!: remove haskell module (#1418)
Given how slow the Haskell module is (#1240), it is slowing down the entire prompt
from rendering when the module is active. This commit removes the module until we
can find a faster way to retreive the Haskell version.
2020-07-06 13:00:52 -04:00
Dario Vladović b176fc35ac
feat(nodejs): support additional file patterns (#1311) 2020-06-21 10:33:58 +02:00
Daniel A. White b238574100
feat(dotnet): adds additional files to detect .net projects (#1303)
* adds additional files to detect .net projects

* test .net output with a regex pattern
2020-06-21 10:22:20 +02:00
Dario Vladović 16b648581e
style(docs): remove `$` prefix from shell snippets (#1339) 2020-06-17 07:31:24 -05:00
Zak Scholl 66297427a8
docs(python): Fix typo in advanced configuration (#1335) 2020-06-15 18:46:08 +02:00
Thomas O'Donnell 055986e2b1
feat(python): Add option to change the python binary (#1297)
* Add option to change the python binary

We are going to start to have problems with the python binary as python2
is removed and replaced with python3. To make the transition easier I
have added an option to the python module to allow the user to pick a
particular binary, e.g `python3`, for the module to use when selecting
the version of python. I have also refactored the python tests moving
almost all of them into the module and removing the dependency on the
version of python that is installed on the system.

* Add advanced config section to python module docs

Have added an advanced config section to the python module docs and
moved the `python_binary` option into that section.
2020-06-14 11:27:10 +02:00
Rekihyt fcd003785b
feat(nim): Add Nim module (#1189)
* Nim module and tests

* Add nim to docs

* parse_nim_version refactor, add nim desc

* Add nim symbol to Nerd Font preset

* Yellow with v prefix as default version

* Nim version fmt fix

* Update docs/config/README.md

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

* Update src/modules/nim.rs

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

* Nim module and tests

* Add nim to docs

* Yellow with v prefix as default version

* Update docs/config/README.md

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

* Update src/modules/nim.rs

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

* Add nim to docs, proper version formatting.

* Remove v from symbol, add to fmt string

* cargo fmt

Co-authored-by: Dario Vladovic <d.vladimyr@gmail.com>
2020-06-09 19:14:47 +02:00