Commit Graph

130 Commits

Author SHA1 Message Date
Alexey Chernyshov 08b74c1672
fix(git_status): Fix file rename inconsistency compared to git (#1411)
* Remove renames_index_to_workdir() option from git status

This option causes advanced files rename detection which causes inconsistency between `git status` and Starship reports.
Closes #1371

* add test for manually remaned and deleted files in git_state module

* fix tests
2020-07-14 23:08:56 +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 7edd0f6218
test(terraform): move tests which do not require env vars (#1455)
Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2020-07-08 20:24:38 -04:00
Zhenhui Xie ec76fafff0
feat: refactor modules to use format strings (#1374) 2020-07-07 18:45:32 -04:00
Walther Chen 489838e6a2
feat: git branch: read from HEAD on newly initialized repo (#1336)
* Git branch: read from HEAD on newly init repo

On a newly initialized git repo, there are no branches created until a
commit is made. Previously, starship handled this by having a default
branch "master" for when branch `head` could not be read.

However, if a user wants to set a different default branch name, that
name won't appear on starship until a commit is made to the branch.

If git2 provides a way to read the default branch name, we can use that,
but at the moment it's not obvious how.

For the moment, we can directly read `.git/HEAD`, which contains the
name of the default branch head reference. This commit implements this
strategy.

Closes #1327

* update git_branch test from unborn master to unborn default

* cargo fmt
2020-07-05 13:22:14 -04:00
Dario Vladović e034d51cb2
feat(git): honor `GIT_DIR` environment variable (#1348) 2020-06-24 17:13:47 -04:00
dependabot-preview[bot] f9bf2324e2
build(deps): bump path-slash from 0.1.1 to 0.1.2 (#1377)
* build(deps): bump path-slash from 0.1.1 to 0.1.2

Bumps [path-slash](https://github.com/rhysd/path-slash) from 0.1.1 to 0.1.2.
- [Release notes](https://github.com/rhysd/path-slash/releases)
- [Changelog](https://github.com/rhysd/path-slash/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rhysd/path-slash/compare/0.1.1...v0.1.2)

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

* Fix tests to improve slash handling on Windows

* Fix number of slashes

* Try fixing the slashes again

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Matan Kushner <hello@matchai.dev>
2020-06-22 18:41:05 -04: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
Julian Gehring d21cb62e3a
Replace `dirs` with `dirs-next` dependency (#1361)
`dirs` will be unmaintained for the foreseeable future, so
switch to the maintained fork `dirs-next`.

Closes #1319.
2020-06-20 12:59:35 -05:00
SeongChan Lee 611a754ec7
fix(directory): Fix path contractions for symlinked git repos (#1299)
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.
2020-06-17 22:44:51 -05: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
Radu Butoi ab1c3d1c54
feat(directory): Add directory substitutions (#1183)
Adds an option to provide a table of strings to substitute in the
directory string. Fixes #1065.

Co-authored-by: Radu Butoi <butoi@google.com>
2020-05-31 19:32:35 +02:00
Matan Kushner a670e01c22
ci: upgrade Python for integration tests (#1243) 2020-05-21 13:13:51 -04:00
John Letey a3e12a1112
ci: Update Python to 3.8.2 (#1181) 2020-05-08 14:25:46 +02:00
Hendrik Rombach 108193103d
fix(git): show branch name in fresh repo (unborn master) (#1093)
* fix: branch_name in fresh repo (unborn master)

* test: add test for unborn branch_name fix
2020-05-06 11:19:53 +02:00
Jean Gautier 02edad0c66
fix(directory): avoid confusing modules with PowerShell paths (#1114)
* 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>
2020-04-30 10:40:56 +02:00
Thomas O'Donnell 060689fa88
fix: Fix latest clippy suggestions (#1136)
Have removed some imports that Clippy says are not needed anymore.
2020-04-24 12:37:13 +02:00
Thomas O'Donnell d91b6b7137
test: Add null tests to modules that don't have them (#1104)
Have added some null tests to modules that don't already have them.
2020-04-15 09:55:32 +02:00
Thomas O'Donnell 5272d5c1ce
ci(python): Fix broken tests (#1103)
Fix the python tests that depend of having the correct version of Python
installed on the build system.
2020-04-14 14:48:10 +02:00
Alex Jurkiewicz 965338df95
feat(python): Add scan_for_pyfiles option (#692)
Also adds two new entries to the list of hardcoded files to check:
setup.py and __init__.py.
2020-04-14 10:26:51 +02:00
Stanisław Barzowski 7c45f74d11
fix: Do not depend on user's config in conda tests (#1098)
The user's config is automatically loaded
in context.new_module. This change explicitly
sets the empty config to avoid depending on
the environment.

Without this fix, the tests do not pass
for users who have a custom symbol defined
for conda. This prevents installing/upgrading
from Arch Linux AUR.
2020-04-13 21:23:49 +02:00
Bernardo Meurer 7718450311
feat(nix_shell): add symbol to nix-shell module (#1058)
* feat: add nix-shell icon

Fixes #1048

* style: make nix-shell bold blue by default

It better matches the whole theme around Nix and snowflakes.
2020-04-07 18:35:18 +02:00
Kevin Pullin 9924af55db
feat(aws): Use AWS_VAULT as the profile if set (#984)
* 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
2020-04-06 16:59:56 +02:00
David Knaack 56d475578e
fix: possible fix for Intermittent Test Failures in GH Actions (#987)
* fix: possible fix for Intermittent Test Failures in GH Actions

* undo some of the chnages to directory.rs

* typo

* add docs
2020-03-15 12:12:25 -05:00
Tadej Novak 7e66791cb2
feat: add singularity module (#932) 2020-02-26 11:18:19 -05:00
Thomas O'Donnell d44c037ba5
test: refactor ruby and php modules to use mocked commands (#936) 2020-02-21 11:52:39 -05:00
nesmyslny 0312c7b91e
feat(git_commit): Show the hash of commits when detached HEAD (#738) 2020-02-12 14:56:29 -05:00
Thomas O'Donnell 67397d9096
test(golang): refactor golang tests to use mocked command (#925)
Refactor the golang module tests to use a mocked command and no
longer depend on having a particular version of Go installed.
2020-02-12 13:22:21 -05:00
Andrew Prokhorenkov cead23edca
test: port Haskell module tests to integration test (#913) 2020-02-06 12:12:07 -05:00
Matan Kushner 11b737bb44
feat!: Update colors of package and php modules (#782) 2020-02-01 18:10:12 -05:00
Matan Kushner 3365beae09 test(nodejs): Port nodejs module tests from E2E to integraton (#867)
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
2020-01-26 16:37:18 -06:00
Andrew Prokhorenkov 6f2c9fb397 feat: add Haskell Stack support (#546)
Add a Haskell Stack module when a stack.yaml file is detected
2020-01-25 00:48:39 -06:00
Thomas O'Donnell 197376633a fix: Fix incorrect prefix usage in cmd_duration module (#832)
Fixed the way the cmd_duration module is setting it's prefix to be the
same as the other modules.
2020-01-18 01:15:08 -06:00
Matan Kushner 8f645ffb8a
ci: Update CI dependencies (#850)
* ci: Replace setup-ruby with use-ruby-action

* ci: Update python version

* ci: Update Ruby version

* Set ruby action to master

* Try installing mercurial earlier in the workflow

* Remove mercurial installation

* Remove mercurial installation on all OSes

* Revert "Remove mercurial installation on all OSes"

This reverts commit 0e1a3e7e928198ece34660494980f00102df8c45.

* Update hg installation comment

* Revert Ruby update

* Add caching

* Add caching to audit

* Update workflow.yml

* Only cache during test steps
2020-01-17 20:43:29 -05:00
Thomas O'Donnell 0879381bcd test: Ignore AWS tests that depend on the File System (#817)
Update AWS module tests to ignore the two tests that can fail if the
`~/.aws/config` file exists.
2020-01-08 18:22:42 -06:00
Matan Kushner 09fe0afc14
ci: Remove Docker test environment from CI (#806) 2020-01-06 00:35:46 -05:00
David Hewson 178f177dac perf(hg_branch): Replace direct calls to `hg` (#803)
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
2020-01-03 17:51:45 -05:00
marblenix b82ff321fa feat(git_status): Add a stash count segment (#598) 2019-12-28 22:20:36 -05:00
Mike Sampson 256a2be949 feat: Implement AWS region aliases (#646) 2019-12-20 12:30:47 -05:00
Luca Rinaldi 6a2b0a67b0 feat: cmd_duration module optionally reports milliseconds (#696) 2019-12-19 17:38:06 -05:00
AppleTheGolden 3c835ba34b fix: Truncate long paths in conda environment names (#694)
Environment names created via conda create -p [path] tend to be too long for comfort, so this truncates them.
2019-12-09 12:59:02 -05:00
wdullaer 44b37a7bac feat: Implement terraform module with workspace and version (#644) 2019-12-08 20:42:51 -05:00
Dan Wendorf dee25c7b35 feat: Add prefix config to directory module (#642) 2019-12-06 14:19:11 -05:00
Qingping Hou c5a206e3cf feat: Add git_commit module (#673) 2019-12-06 11:57:42 -05:00
Stephen Ball 46904e5045 feat: Add PHP version module (#244) 2019-12-05 13:04:27 -05:00
Luca Greco 337f213753 feat: Add the hg_branch module (#569) 2019-12-02 17:37:18 -05:00
Matan Kushner 4895276b1b
ci: Update Python to 3.7.5 (#628) 2019-11-05 16:23:33 +09:00
Thomas O'Donnell 42f6868e3f feat: Enable the python module in virtual envs (#584)
This will enable the python module when a virtual environment has been
activated, this is detected via the `VIRTUAL_ENV` env var.
2019-11-02 20:10:21 +09:00
Cédric Da Fonseca fa1267f12f feat: Add configuration to set how much AWS profile info is shown (#556) 2019-11-02 20:08:54 +09:00
Brian Low 2710d02709 feat: Show git_status counts (#434)
The git_status module can show the count of files next to their respective symbols.
2019-10-26 15:20:20 +09:00