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

944 Commits

Author SHA1 Message Date
Kevin Song
393d62c726
feat(rust): Display toolchain names (#3414)
This is an actualization of PR #559 as originally envisioned by qryxip.

Adds the ability to display toolchain versions, either as extracted from
environment/settings files or by getting the host triple. As part of
this, several other major changes were needed:
- Many of the smaller functions within the code have been fused, moved,
  or dropped.
- The Rustup environmental info is now initialized lazily using
  OnceCells. This will hopefully lead to a performance increase.
- New configuration variables (`toolchain` and `numver`) have been added
  to allow finer-grained configuration.
- Override information is no longer read from `rustup` output. Instead,
  it is parsed from the same files that rustup would use to determine
  this info.

Co-authored-by: qryxip <qryxip@gmail.com>

Co-authored-by: qryxip <qryxip@gmail.com>
2022-05-04 15:40:44 -05:00
Thanapat Chotipun
2bf30dc89f
feat(hostname): add ssh_symbol for ssh connections (#3806) 2022-05-04 15:30:16 +02:00
David Knaack
c768d039d1
test(custom): increase timeout in timeout test (#3960) 2022-05-02 21:01:43 -05:00
Tom Fleet
1b938fd484
feat(package): Extract package version from PEP 621 compliant pyproject.toml (#3950)
* feat(package): Extract package version from PEP621 pyproject.toml

* Update docs explaining PEP 621 package version

* Only read pyproject.toml once

* Simplify get_pep621_version

* Handle version formatting in get_pyproject_version
2022-05-02 18:44:01 +02:00
Kevin Song
2e80aec5cb
fix: Do not panic in config if editor not found (#3766)
* fix: Do not panic in config if editor not found

* Add tests for edit_configuration

Adds tests for no-panic condition on editor by adding an override to
edit_configuration.

* Sorry clippy :(
2022-05-02 18:43:27 +02:00
Gabe Weiner
6fe6735927
fix(module): list option not working (#3919) 2022-04-28 22:27:09 +02:00
David Knaack
bd7957f01c
fix(git_branch): correct variable name for remote branch (#3897) 2022-04-26 20:02:01 +02:00
David Knaack
d4d84a592c
build: bump nix from 0.23.1 to 0.24.1 (#3925)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-26 09:14:51 -04:00
Thomas O'Donnell
2a650bfd14
perf(package): only try to read files that exist (#3904)
* perf(package): only try to read files that exist

Have refactored the package module to improve performance. Before this
change the module would try to open every single file that could contain
some package information until it found a valid version. This resulted
in a lot of unneeded disk IO. Have added a new fn, `read_file_from_pwd`
that uses the current context to check if that file already exists and
fast failing if it doesn't. From my local testing this speeds up the
package module from taking ~1ms to ~50µs in an empty directory.

* refactor: move read_file_from_pwd to context

* refactor(haskell): use read_files_from_pwd

* refactor(nodejs): use read_files_from_pwd
2022-04-25 16:18:01 +02:00
David Knaack
6c2b51a621
refactor(windows): replace winapi with windows (#3690) 2022-04-21 20:59:00 +02:00
Fábio Antunes
6def45b751
chore(aws): adds space to the duration variable (#3872) 2022-04-21 20:58:06 +02:00
David Knaack
ff490b67ad
test(git): enable fsync for git operations (#3889)
* test(git): enable `fsync` for git operations

* add comment
2022-04-20 18:39:24 +01:00
Yt
efaab49e47
feat(cmd_duration): make notify feature optional (compat with nix darwin) (#3855) 2022-04-12 12:07:36 +02:00
David Knaack
28da85061b
refactor(custom): various improvements (#3829) 2022-04-09 11:32:45 -04:00
David Knaack
21dfe7f2fc
refactor(aws): improve parsing of config files (#3842) 2022-04-08 06:56:14 +02:00
David Knaack
4b7275efc4
refactor(gcloud): improve parsing of config files (#3844) 2022-04-08 06:56:02 +02:00
Thomas Kintscher
230e85be37
fix(docker_context): ignore the "default" context (#3803) (#3804)
Co-authored-by: Thomas Kintscher <thomas@flowciety.de>
2022-04-07 07:54:50 +02:00
t-mangoe
441ebb39b9
fix(directory): enable repo_root_style when truncation_length is zero. (#3536)
* Update merge-dependabot.yml

* Revert "Update merge-dependabot.yml"

This reverts commit b13a329660cc1f6fe57b29bc488764181a2ba66c.

* Update merge-dependabot.yml

* Revert "Update merge-dependabot.yml"

This reverts commit b13a329660cc1f6fe57b29bc488764181a2ba66c.

* fix(directory): enable repo_root_style when truncation_length is zero.

* run dprint fmt

* fix README

* fix README

* revert README.md
2022-04-04 21:13:29 +02:00
Hofer-Julian
2608db3a38
fix(nu): Use = instead of space to pass command line parameters (#3833)
This fixes https://github.com/nushell/nushell/issues/5074
2022-04-04 20:03:43 +02:00
David Knaack
03343272b7
fix(bash): ensure checkwinsize is enabled for $COLUMNS (#3832) 2022-04-03 15:07:19 -04:00
oyanoya
3014284e95
feat(spack): Add Spack module (#3639)
* feat/add readme + presets

* feat/add spack module

* feat/add spack config

* feat/spack to handle

* feat/add spack to modules and root

* fix/readme formattign

* fix/readme typo

* fix/readme formatting

* feat/replace module_config_derive with serde

* feat/add macros to generate schema + schema
2022-04-03 15:33:14 +02:00
Rashil Gandhi
c89c13038a
feat(username): Detect Admin access in Windows (#2791)
* Detect Admin access in Windows

* Update username doc

* Do not run tests when elevated

* Add comment

* Try fixing tests

* use deelevate crate

* simplify cfg

* Update src/modules/username.rs

Fix rookie mistake

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

* handle errors

* fix lockfile error

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2022-04-01 17:47:49 +02:00
David Knaack
18ad26f98d
feat: allow printing config file schema (#3737) 2022-04-01 17:14:05 +02:00
David Knaack
859b780b46
fix(nu): use shell-provided terminal width (#3800) 2022-03-28 13:40:06 -04:00
David Knaack
2d4b183fce
refactor: replace module_config_derive with serde (#3786)
* refactor: replace module_config_derive with serde

Changes include:
* Removing `starship_module_config_derive` and replacing it with `serde::Deserialize`
* Removing `RootModuleConfig::load_config`. While potentially useful, it was only used in tests. And it would require something like `serde::DeserializeSeed` which is not derived by serde.
* Merging `RootModuleConfig` into `ModuleConfig`
* Implementing a `ValueDeserializer` that holds a reference to a `toml::Value` in `serde_utils.rs`
* Deserialization errors (invalid type) are now logged and include the current key and the struct names
* Unknown keys are now considered an error. "Did you mean?"-messages are still possible

* fix typo

Co-authored-by: Matan Kushner <hello@matchai.dev>

Co-authored-by: Matan Kushner <hello@matchai.dev>
2022-03-26 10:42:19 +01:00
tani
0fb4219690
fix(fish): allow generating session keys in older versions of fish (#3697)
* fix(linux): session key generation in fish

* fix(fish): use string sub commands for the compatibility

* fix(fish): add comment
2022-03-26 10:34:46 +01:00
Alex Douze
e04f126a10
feat(aws): add option to force AWS display (#3720)
* add option to force AWS display

Even if no credentials or credential_process have been setup

* change README wording

* Include sso_start_url in the description

* Change option name to force_display
2022-03-25 22:30:36 +01:00
Kevin Song
538329d9b4
fix(init): Change Elvish init to catch for 0.18 (#3769) 2022-03-25 11:57:38 +01:00
David Cantrell
0863146f07
feat: Add a module for C projects (#3631)
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2022-03-25 00:10:19 -04:00
David Knaack
c9b75fe115
fix(init): Change Nushell init for nu 0.60 (#3773) 2022-03-24 15:06:24 -04:00
David Knaack
8d3bffdb6c
build: bump shadow to 0.10.0 & git2 to 0.14.2 (#3767) 2022-03-19 21:01:57 -04:00
ksqsf
72fec559c5
feat(haskell): Add Haskell module (#3587)
* feat(haskell): add haskell module and implement ghc version detection

* feat(haskell): implement stack resolver version detection

* fix(haskell): handle more complex resolvers

* fix(haskell): rename resolver_version to snapshot

* fix(haskell): change default color to bold purple

* feat(haskell): add tests

* fix(haskell): format

* fix(haskell): replace incorrect `or` with `or_else`

* fix(haskell): use write_all instead of write

* fix(haskell): λ as Haskell icon by default

* fix(haskell): fix tests and add a real stack.yaml testcase

* fix(haskell): make clippy happy
2022-03-18 07:45:51 +01:00
David Knaack
d7308203a9
fix(aws): accept sso credentials (#3718) 2022-03-16 23:14:52 +01:00
IsaacHorvath
bae16b525d
feat(git_branch): add 'ignore_branches' option (#3753)
* git-branch: Add option 'ignore_branches'

* git-branch: add 'ignore_branches' test

* git-branch: comma-separated to toml array

* git-branch: update ignore_branches test

* git_branch: fix formatting

* git-branch: fix formatting again

* Initialize ignore_branches as empty

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

* Use iter().any and branch_name as suggested

* Fix formatting

Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2022-03-16 21:41:49 +01:00
Izhak Jakov
86953272a7
fix(status): Make status module work even when the status is 0 (#3750)
Co-authored-by: Izhak Jakov <jizhak@ca.ibm.com>
2022-03-16 16:05:13 -04:00
kuno
59622bc41b
fix(aws): Make AWS_REGION orverrides AWS_DEFAULT_REGION (#3619) (#3733)
* fix(aws): Make AWS_REGION orverrides AWS_DEFAULT_REGION (#3619)

* fix(aws): Align the coding style of region and profile env var (#3619)
2022-03-14 22:49:23 +01:00
Kid
a10e24b205
feat(nodejs): check for .mts and .cts files (#3734)
* feat(nodejs): check for `.mts` and `.cts` files

* Hmm

* Tests

* Update docs

* Update table

* Align

* Remove tests

* 🤷

* 🤷🤷
2022-03-12 23:09:16 +01:00
Luc Perkins
16f62d7904
feat(buf): Add Buf module (#3661)
* Add initial Buf module logic

* Add tests for Buf module

* Add initial draft of docs

* cargo fmt

* Fix config table formatting

* Run dprint

* Run clippy --fix

* cargo fmt

* Add space after emoji

* Fix spacing discrepancy

* Switch to Nerd Font from emoji

* Fix up docs merge conflict handling

Co-authored-by: Matan Kushner <hello@matchai.dev>
2022-03-12 12:10:23 +01:00
Anders Eurenius Runvald
ac8c2fe024
feat(aws): Add profile aliases (#3699)
* Rename m.aws.alias_region to alias_name

* Add aws profile aliases

* Document aws.profile_aliases, with examples

* Add tests for new aws.profile_aliases feature

* Tidy alias_handling a bit
2022-03-12 12:08:33 +01:00
Denis Cornehl
076a9e6b8e
fix(rust): overrides should only check full segments (#3668)
Fixes a bug in the Rust module where overrides would match
against both full path components as well as partial ones
(e.g. "/etc/passwd" would be considered a prefix of 
"/etc/passwd_new") on Windows.

Solution is to convert back to a PathBuf after lossy conversion
so that Path::starts_with is used instead of str::starts_with.
2022-03-08 13:58:58 -06:00
David Knaack
d2366ddb9c
perf(git_status): add option to use windows starship to render in wsl (#2146) 2022-03-06 21:18:23 -06:00
Ikko Ashimine
71e8a47a03
chore: fix typo in main.rs (#3669)
Intialize -> Initialize
2022-02-28 11:27:33 -05:00
David Knaack
4369c92d40
perf(rayon): restrict thread count (#3667) 2022-02-27 12:37:43 -06:00
baoyachi. Aka Rust Hairy crabs
2119938692
build: bump shadow-rs from 0.8.1 to 0.9.0 (#3648) 2022-02-26 11:34:48 -05:00
David Knaack
1745392909
refactor: fix new clippy/compiler warnings (#3656) 2022-02-24 23:31:01 -05:00
David Knaack
1a8aa96b7f
fix(windows): avoid verbatim paths (#3638) 2022-02-23 18:32:35 -05:00
David Knaack
e09b821c42
build: bump clap from 3.0.14 to 3.1.0 (#3630)
* build: bump clap from 3.0.14 to 3.1.0

Bumps [clap](https://github.com/clap-rs/clap) from 3.0.14 to 3.1.0.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v3.0.14...clap_complete-v3.1.0)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* refactor(clap): fix deprecation warnings

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-19 22:24:11 +01:00
zensayyy
d09f71720e
feat(kubernetes): add context user and cluster variables (#3569)
* added kubernetes context user, cluster + basic test

* updated docs

* docs format

* changed get_kube_ctx_component to return struct
2022-02-16 23:20:29 +01:00
Allan Lago
e70454956f
fix(aws): Only display AWS if there are credentials configured (#3504)
* only display aws on credential_process defined

* add check for both credential_process and valid credentials

* fix tests

* update aws module documentation

* add better explanation of requirements to documentation

* add support for AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, and update docs

* remove credential_process env var
2022-02-16 23:19:13 +01:00
cubercsl
efb16dd9ca
fix(localip): disable localip module default (#3607) 2022-02-14 09:51:29 -05:00
Kotaro Abe
32aca11c4a
Add option gcloud.project_aliases (#3599)
* feat: gcloud.project_aliases

* feat: add option gcloud.project_aliases
2022-02-14 13:16:45 +01:00
David Knaack
0ea16e2641
fix: ignore empty --jobs argument (#3593) 2022-02-14 13:12:31 +01:00
Rashil Gandhi
e9e090e97e
fix(fish): Emit clear-screen escape sequence only in left prompt (#3588) 2022-02-14 13:11:55 +01:00
Shan Zhou
465e6fc4be
fix(pwsh): Use global:error[0] for most recent error in powershell (#3584)
* Use global:error[0] for most recent error

The current version use $error[0], which is for the module instead of the global status and is always $null, so the $lastExitCodeForPrompot is always $origLastExitCode (see https://github.com/starship/starship/issues/3485 for a related bug).
It should be replaced with $global:error[0] 
Comments are also updated

* fix(pwsh): make Semantic PR bot happy
2022-02-11 12:07:50 +01:00
Jesús Lapastora
c3cc40d2ac
feat(cli): Print arguments if argument parsing fails (#3560)
* fix(#3554): Print the command line argv on clap error

This is a very bare implementation that just prints the error
and then a note with the arguments passed, it does this manually
and doesn't use clap. I've also chosen to use `Vec`'s `Debug`
implementation instead of rolling my own one because I thought it was
good enough, but there might be a better way of doing all this.

Altogether, I think this will be very useful to help in the diagnostic
of other bugs :)

* fix(#3554): Print the command line argv on clap error

This is a very bare implementation that just prints the error
and then a note with the arguments passed, it does this manually
and doesn't use clap. I've also chosen to use `Vec`'s `Debug`
implementation instead of rolling my own one because I thought it was
good enough, but there might be a better way of doing all this.

Altogether, I think this will be very useful to help in the diagnostic
of other bugs :)

EDIT: removed `dbg!`, set it to exit always.

* correctness(exit): don't print argv / exit with error on help and
version error kinds

* fix: Avoid panicking when stdout/stderr closing unexpectedly

* refactor(cli): use `use_stderr` instead of manual match for error kinds

`clap` uses `use_stderr` to reliably check whether the error given is
actually an error coming from user input or rather a hint to display
other info (version, help, etc.)

Also reworded/moved a couple of comments so that they explain better
what is the thought process behind the code
2022-02-06 23:04:28 +01:00
Coelacanthus
589576d3eb
refactor(zsh): using add-zsh-hook instead of add hook manually (#3537)
[1]: https://github.com/starship/starship/pull/3480#discussion_r790280291
[2]: https://zsh.sourceforge.io/Doc/Release/User-Contributions.html#Writing-Themes

Signed-off-by: Coelacanthus <coelacanthus@outlook.com>
2022-02-05 22:37:34 -08:00
moko256
bbdb584f45
fix(status): Enable to convert from i64 to hex_status by casting instead of parsing status. (#3462)
* fix(status): Enable to convert from i64 to hex_status by casting instead of parsing status.

* Apply comment to src/context.rs

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

* Update README.md in configuration

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2022-02-05 21:13:42 +01:00
Segev Finer
0b184c3ccb
feat(pwsh): Set ExtraPromptLineCount (#3439)
* feat(pwsh): Set ExtraPromptLineCount

Fixes #3419

* Rename $prompt to $promptText
2022-02-05 21:12:47 +01:00
Marlon Richert
aaf4c17122
refactor: Improve compatibility with Zsh prompt theme system (#3480)
Zsh's `promptinit` expects a theme's hook functions to be named `prompt_<theme>_<hook>`. See 2876c25a28/Functions/Prompts/promptinit (L155)
2022-02-03 21:53:38 +01:00
Kevin Song
5efb78bcd3
fix: Correctly detect older versions of powershell in bug-report (#3543)
* Factor out the shell version function

* Correct command to trim spaces + header
2022-02-03 21:51:39 +01:00
Marc Schreiber
dcf66659d0
feat: Enable Undistract Me for Linux (#3547)
In #1019 the undistract feature has been added to starship without
enabling it by default due to the system dependency on libdbus. With
recent versions of notify-rust the dependency is no longer required and
the feature can be enabled by default.
2022-01-31 15:28:13 -06:00
QuiCkSTaR
5a26355b0e
feat(localip): add module to print the current ipv4 address (#3289) 2022-01-30 21:31:26 +01:00
Kevin Song
6e24358052
fix(bash): Restore previous exit status in bash init (#3521)
* fix: Restore previous exit status in bash init

* Do it correctly this time
2022-01-30 10:52:51 +01:00
TrickyPi
65f29754d3
fix(nodejs): use e718 as the default of symbol in node configuration (#3533)
* fix: use e718 as the default of symbol in node configuration

* wip: change nodejs symbol in docs/config & add a nodejs symbol configuration in docs/presets

* wip: update CONTRIBUTING.md
2022-01-30 10:28:00 +01:00
Lyndon Sanche
e680540cfc
feat(cmd_duration): Make notification timeout configurable (#3515)
* Allow customization of notification timeout

* Document new notification duration option

* Check for out-of-bounds timeout and correct it

* Implement ModuleConfig for u32

* Revert "Check for out-of-bounds timeout and correct it"

This reverts commit 52109ab5f7c336b55c81bccafb3adbfc81514553.

* Switch notification_timeout to u32

* Note notification_daemons might not honor timout

* Notification timeout defaults to daemon timeout

* Leave default value of notification_timeout blank in docs
2022-01-29 22:56:55 +01:00
David Knaack
6ca911b9fe
fix(elvish): use $pwd for logical-path (#3534)
The `$PWD` environment variable used by starship is not updated on startup by `elvish`. `elvish` also provides a separate `$pwd` variable that does get updated and seems to be be a better indicator for the current logical path.
2022-01-28 21:48:10 +01:00
Joseph Chung
b99d3b8e24
feat: starship bug-report sets syntax highlighting for config file (#3529)
Set the syntax highlighting for the config file in starship bug-report, using the triple backtick syntax.
2022-01-28 14:17:49 +03:00
Aaron Friel
568d057032
feat: add username to Pulumi module (#3428)
* feat: add username to Pulumi module

* run dprint fmt
2022-01-25 10:40:44 -06:00
Kevin Song
08b5ad94fd
ci: Fix aws::expiration_date_set_from_file race (#3484)
* ci: Fix aws::expiration_date_set_from_file race

While aws::expiration_date_set_from_file will almost-always work
perfectly locally, it is theoretically possible for the thread running
the test to be scheduled away betwen writing the file with timing
information and then actually reading it, resulting in a
shorter-than-expected time appearing in the module. This can also happen
if the test triggers right at the very end of a second (e.g. at
10:45:47.999995).

This appears to actually happen sometimes on heavily-loaded GitHub
Actions runners. To fix this issue, we allow for up to a two-second
delay between when the file is written and when the test actually fires
(allowing "30m", "29m59s", and "29m58s" as possible values).

* Fix typo
2022-01-22 12:54:04 +01:00
Harald Hoyer
4f46411403
feat: add a container indicator (#3304)
* test: add mock method for absolute files

Signed-off-by: Harald Hoyer <harald@hoyer.xyz>

* feat(module): add a container indicator module

Adds a container type indicator, if inside a container,
detected via the presence of some marker files.

E.g. inside a podman container entered with `toolbox enter`
the prompt changes to the container name and version.

```
starship on  container_rebased [$!] is 📦 v1.0.0 via 🦀 v1.56.1
❯ toolbox enter

starship on  container_rebased [$!] is 📦 v1.0.0 via 🦀 v1.56.1
⬢ [fedora-toolbox:35] ❯
```

Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
2022-01-21 09:44:46 -06:00
moko256
0d573ac5ea
perf(elvish): Use built-in randint instead of starship session. (#3479) 2022-01-21 08:08:14 +01:00
Segev Finer
7e32fd952e
feat(pwsh): Set STARSHIP_SHELL to pwsh on PS >5 (#3443)
* feat(pwsh): Set STARSHIP_SHELL to pwsh ON PS >5

This is needed for the custom module to use the correct shell.

Closes #3376

* Update src/context.rs

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

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2022-01-16 20:28:26 +01:00
David Knaack
0fd6f05da4
fix(properties): fix regressions in status, pipestatus and terminal-width handling (#3399) 2022-01-15 04:21:38 -05:00
David Knaack
8985499c95
fix: allow compilation without battery feature (#3435) 2022-01-14 22:12:10 +01:00
Segev Finer
0b6ffca35d
fix(pwsh): Avoid polluting the global function namespace (#3424)
* fix(pwsh): Avoid polluting the global function namespace

This is an alternative to #3386

* Review changes

* Move continuation prompt after setting starship env
2022-01-14 21:54:29 +01:00
David Knaack
673a198176
fix(bug-report): remove git.io link shortening (#3425) 2022-01-14 15:22:36 +03:00
Rashil Gandhi
c335b4267b
feat: add support for cmd (#3277)
* feat: add support for cmd

* add preprompt and precmd support

* add keymap support

* add info about minimum Clink version

* simplify escaping

* add handling for cmd custom commands

* add support for transient_prompt and transient_rprompt

* Revert 914057952508e81e20086fcb707ba2a0be85fdd3

This reverts commit "add support for transient_prompt and transient_rprompt"

* Apply suggestions from code review

* disable cmd shell custom commands

* any shell other than cmd can be used

* better error and correct script location

* move shell check in `map_no_escaping`
2022-01-09 23:47:53 -06:00
moko256
500dc3ea6e
feat(elvish): last command status (#3403) 2022-01-06 22:00:38 +01:00
David Knaack
20cf200c3a
refactor: update clap to v3 (#3370) 2022-01-04 12:49:42 +03:00
David Knaack
35eae3fb4a
refactor(process_control): switch to new API (#3385) 2022-01-03 09:14:19 -05:00
Zhong Liu
295948bc6c
feat(package): support for dart pub version (#3373)
* feat(package): add support for dart pub version

* feat(package): add doc for dat pub version
2022-01-01 23:57:20 +01:00
Matan Kushner
800fbec0cf
fix: update continuation prompt to be more minimal (#3374)
Co-authored-by: Kevin Song <chips@ksong.dev>
2022-01-01 14:39:08 -05:00
Ryan Cohen
4deaa02d6f
feat: set a continuation prompt for supporting shells (#3322)
* feat: set a continuation prompt for supporting shells (#3134)

* docs: fixed wording of documentation

* fix: continuation prompt is now only set once

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

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

* fix: update --continuation argument

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

* fix: updated continuation prompt

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

* fix: ran rustfmt

* docs: updated continuation prompt docs

Co-authored-by: Segev Finer <segev208@gmail.com>
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2022-01-01 14:12:11 +01:00
David Knaack
2b405042b9
feat(xonsh): support rprompt (#3362) 2021-12-31 08:23:01 +01:00
Ikko Ashimine
c5a5fc2820
chore(directory): fix typo (#3364)
seperators -> separators
2021-12-31 08:22:46 +01:00
David Knaack
3b7446fdf3
fix(rust): fix overrides on windows and set cwd (#3359) 2021-12-30 18:24:21 -06:00
arcnmx
a95332485b
perf(git_status): tweak exec flags to omit unnecessary info (#3287)
* perf(git_status): tweak flags to omit extra info

`git status` can be prohibitively slow on some repos, so allow the
config to influence what flags are passed to git. For instance, if there
is no configured symbol for untracked files, tell git to omit them from
its output. This can easily result in a 2~10x speedup in many cases, but
requires the user to opt-in to hiding information from the prompt.

* docs(git_status): add ignore_submodules option
2021-12-30 15:12:53 -06:00
Segev Finer
1c305c9de7
feat(directory): Windows path formatting via path_slash::PathBufExt (#3157)
* feat: Experimental Windows path formatting via path_slash::PathBufExt

* Rework the slash path conversion into a real PR

* Add a test for convert_slash = false

* Attempt fixing CI failures

* Fix lint and fmt

* Fix docs/config/README.md getting messed up

* Rename convert_slash/from_slash

* Move convert_path_sep calls in tests

* Keep path_vec immutable

* Run rustfmt
2021-12-30 09:57:13 +01:00
Maximous Black
f48c7a26cf
feat(deno): detect deno.json and deno.jsonc (#3220)
* feat(deno): detect `deno.json` and `deno.jsonc`

* update docs

* update tests

* cargo fmt

* revert lockfile changes

* revert doc updates to non-english files

* Restore README.md

* fmt
2021-12-30 09:55:46 +01:00
David Knaack
67cddb616b
fix(elvish): upgrade shell integration for v0.17 (#3310) 2021-12-30 09:49:55 +01:00
Denis Cornehl
c63e9a71bd
perf(rust): additionally check rustup default for faster result. (#3354)
* perf(rust): additionally check `rustup default` for faster result.

After checking directory overrides we were directly falling back to the
relatively slow call to `rustc --version`.

Inserting a call to `rustup default` leads to a quicker response.

* use `context.exec_cmd` instead of `create_command`
2021-12-28 21:10:49 +01:00
David Knaack
af98f5b8ce
fix: set cwd for command execution (#3309) 2021-12-27 23:56:06 -06:00
Zhong Liu
8d0cebdcbd
fix(dart): detect version output in stdout with dart 2.15+ (#3349) 2021-12-24 09:43:07 -05:00
Mika Fischer
cb40787e2a
feat(status): Add hex_status (#3312) 2021-12-21 05:05:28 -05:00
Lucien Fiorini
a8579d6f2f
fix: Display durations of 0ms (#3121)
Previous code would render all components as empty, resulting
in an empty string even if min_time was 0. This adds a special
case which forces prompt to render "0ms"
2021-12-20 15:58:25 -06:00
Denis Cornehl
006fbf0dd5
fix(aws): prevent endless loop when AWS config file is a directory (#3335)
When opening a directory as a file the intial open works, while
subsequent line-reads will fail with _is a directory_.
Since erroring line-reads were just skipped this lead to an
endless loop.
2021-12-20 21:15:00 +01:00
Mika Fischer
b21904c9d3
fix: Store $? and $LASTEXITCODE first in PowerShell (#3316)
These need to be stored before calling any PowerShell function or executable.
Otherwise the values will be overwritten and cannot be properly restored
or passed to starship.

Fixes: #3315
2021-12-13 10:15:02 +01:00
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