* test that we can match a multi-part file extension such as in foo.tar.gz
* now we can match multi-part file extensions like on foo.tar.gz
* add a test that a !ext is a negative match and over-rides any positive match
* test that negative extensions that don't match any file have no effect
* fail the match if any negative extensions exist
* cargo fmt
I'm not happy with this, in particular it's made the structures of has_any_positive_extension and has_no_negative_extension look different, and the logic in is_match is harder to follow
* placate clippy
* documentation for multi-part extensions and negative extensions
* get rid of an unnecessary .to_string() and comment the necessary but weird-looking invocations of .to_string_lossy().to_string()
* tests for negative matching of files and folders
* fail the match is any negative files/folders match
* document file/folder negative matching; be less prolix
* suppress Nodejs if Deno files are present (#2627)
* Revert "suppress Nodejs if Deno files are present (#2627)"
This reverts commit c1394fd7b37bb0bf06b1449e074020a2e16bfa04.
This was a terrible way of doing this, there's got to be a better way!
Have added configuration options to the k8s module to allow activating
the module only in directories that contains certain files or folders.
To ensure this is backwards compatible and because there are not really
any standard files or folders for Kubernetes I have set the defaults to
empty and will activate the module for all directories.
Have switched all vi/vim symbols to have the same prefix 'vim'. To
preserve backwards compatibility with existing configs I have added an
alias for the previous config name.
* add proper vi mode detection for fish shell
* update tests
* fix test
* update config-schema.json
* update docs
* add warning about symbols only supported in fish
* check for go.work file to display go version
* add test to check for go.work file
* update docs to include go.work file
* chore(dprint): fmt & upgrade plugins (#3969)
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
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>
* 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
Have added so additional spaces around the vuepress markers, `:::`, to
ensure that the don't get included in the line above and below and cause
formatting errors in the translated versions of the documentation.
* 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
* 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
* 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
* 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
* 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>
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.
* 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
* 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
Have updated the workflow to only run the "Block Translated Changes" job
on PRs since it will fail when run on pushes to a branch. Have fixed the
formatting while I was here.
* 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>
* Fixed starship config location
config file during creation and when used as export variable into shells are different.
Fixed to make it uniform and avoid errors
* Update README.md
* Update docs/config/README.md
Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
* Update docs/config/README.md
Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
* 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>
* 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`
* 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
* 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
* 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>
* 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>
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.
* 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.
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.
* 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
* 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
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.
* 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
* 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