Have switched the fallback shell used when the custom module can't use
the default to use `/usr/bin/env sh` rather than `/bin/env` since
`/usr/bin/env` is more commonly available.
Fixes git repo path contractions in two situations:
1. When path obtained from `PWD` is a logical path but git libraries
return physical paths.
2. When a git repository's subdirectory is symlinked to ouside of the
repository tree.
(1) is fixed by implementing a realpath()-like function, then reparsing
the (possibly logical) `PWD` using realpath() to convert logical
components into physical ones. The physical paths are then matched
against each other.
In the case of (2), the default behavior has been changed by simply
contracting to the home directory, exactly the same as if we are not in
a repo at all. Because determining the correct contraction is not
obvious, we bail out and just pretend we are not in a repo at all.
* 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.
PHP will output error messages when displaying the version if, for
example, there is something wrong with the local `php.ini` file. Have
updated the command used to get the PHP version to only use the default
PHP config.
* 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>
* Creation of range field in TimeConfig
* time_range parsing
* Hide time module if outside of time_range
* Tidying of code, and properly handling more cases
* is_inside_time_range function
* Tests and fmt
* Update docs
* The configuration needs the 24-hours format
* Fix clippy errors
To improve overall support of PowerShell in custom modules,
the ability to pass arguments to the shell was also added. Additionally,
the arguments `-NoProfile -Command -` will be automatically passed
to PowerShell, unless other arguments are given by the user.
* Added configs/purescript
* Added modules/purescript
* Added necessary codes
* Added tests
* Updated README
* Fixed color because black is hard to see
* Fixed of push mistake
* Fixed pointed out in PR
* Avoid confusing modules with PowerShell paths
* Avoid confusing modules with PowerShell paths
Powershell supports PSDrives (https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-psdrive?view=powershell-7) that allow to create "logical" drives mapped to actual Windows drives.
* Preserve Windows directories
* Preserve logical paths for Powershell
* Fix formating with cargo fmt
* Fix directory_in_root test
Co-authored-by: Jean Gautier <jean.gautier@ssi.gouv.fr>
* feat: Modify config keys from shell
* chore: Fix clippy
* refactor: Add `configure` as alias
* chore: Remove redundant code
* fix: Soft error if user doesn't pass in valid key
* feat: Support integers and booleans
* chore: Fix clippy
* refactor: Use exit instead of abort
Co-Authored-By: Thomas O'Donnell <andytom@users.noreply.github.com>
Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
According by this standards
> While "Julia" is a female name in many parts of the world, the programming language is not a person and does not have a gender.
* Use AWS_VAULT as the profile if set
[aws-vault](https://github.com/99designs/aws-vault) sets
the `AWS_VAULT` env var instead of `AWS_PROFILE` when an
aws-vault session is active.
This PR adds support for reading the AWS profile value from
the `AWS_VAULT` env var, giving priority to `AWS_VAULT` if both
it and `AWS_PROFILE` are set.
* Update docs for AWS_VAULT
* feat: add docker context module
Adds a simple module that checks for a Docker config file and if present, reads the `currentContext` value out and displays on the prompt with a whale.
* feat: add `only_with_compose_yml` option to docker_context
When enabled, will only show the docker context name if there's a docker-compose.yml file in the current directory.
* Update src/modules/docker_context.rs
Co-Authored-By: Thomas O'Donnell <andytom@users.noreply.github.com>
* Update src/modules/docker_context.rs
Co-Authored-By: Thomas O'Donnell <andytom@users.noreply.github.com>
* rename `only_with_compose_yml` configuration key to a more generic `only_with_files`
* Update src/modules/docker_context.rs
Co-Authored-By: Thomas O'Donnell <andytom@users.noreply.github.com>
* re-order configuration table
* Update docs/config/README.md
Co-Authored-By: Thomas O'Donnell <andytom@users.noreply.github.com>
* Update src/configs/docker_context.rs
Co-Authored-By: Thomas O'Donnell <andytom@users.noreply.github.com>
Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
* Allow kubernetes module to use aliases for contexts
* documentation for kubernetes context aliasing
* Apply suggestions from code review: consistent ordering of options in documentation
Co-Authored-By: Thomas O'Donnell <andytom@users.noreply.github.com>
Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
* fix: check if editor is not found for `configure`
STD_EDITOR falls back on `vi` if $EDITOR and $VISUAL is not set.
However, some machines might not have `vi` symlinked or installed and a
bad error message is displayed. This commit adds a better error message.
* fix lint errors
* Change NotFound to write to stderr instead of panic!
Oh wow writing rust makes my commit messages look very enthusiastic!
`private: true` in `package.json` files means that the package is not supposed to be published to npm, which makes the `version` field meaningless, so we should probably ignore it to not clutter the prompt too much.
This PR adds package version support for Gradle projects. The version number is extracted from the `build.gradle` file in the current directory, similar to existing support for other packages.
Replaces the existing nodejs module end-to-end tests with integration tests that don't require preinstalled environmental dependencies.
- Moved the tests to the same file as the module they test
- Created a render_module utility function for rendering modules within tests
- Removed Node.js installation during CI setup
- Add Shell to Context to allow for tests to not run shell-specific code
Currently the Java module detection looks for build.gradle specifically, but it's possible to rename build.gradle to *.gradle. This change adds Gradle files to the list of detected file extensions.
perf: don't use hg process to get branch / bookmark information, each call was taking 250ms and it was making on average 2 calls.
the branch and bookmark information is available in files in the root of the repo, use that instead.
now takes 300 micro seconds
fix: do not use .hgignore to decide if it is an hg repo. was providing false positives. #721
fix: after changing branch the new branch was not show (the old branch was shown), the new branch is now correctly shown. #722
fix: if no branch override was set it would say (no branch) however if you commited in that state you would commit to the branch default so say that instead