Commit Graph

341 Commits

Author SHA1 Message Date
Gerry 427f48aa8d
fix(nodejs): remove line break from version (#1464)
A recent refactor of modules to use format strings accidentally got rid
of the `trim()` on the NodeJS version string. This just adds it back so
that the prompt doesn't include an unnecessary line break when showing
that module.
2020-07-10 11:41:25 -04:00
Tilmann Meyer bd68970fab
feat(cmake): Add CMake module (#1456)
* feat: CMake module

* docs: Document symbol variable
2020-07-09 21:40:33 +02:00
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
Matan Kushner 428a78ebb5
fix!: remove haskell module (#1418)
Given how slow the Haskell module is (#1240), it is slowing down the entire prompt
from rendering when the module is active. This commit removes the module until we
can find a faster way to retreive the Haskell version.
2020-07-06 13:00:52 -04:00
Dario Vladović ec0b577204
fix(ocaml): trim OCaml verison (#1436) 2020-07-05 21:51:04 -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
Thomas Haessle 021d82a224
fix: manage sandboxed version of OCaml (#1433)
* fix: manage sandboxed version of OCaml

* fmt: apply cargo fmt

Co-authored-by: Thomas Haesslé <thaessle@cutii.io>
2020-07-05 13:20:11 -04:00
Thomas O'Donnell 6e289721d4
fix(custom): Fix fallback shell not working on macOS (#1402)
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.
2020-06-28 15:41:05 -04:00
Thomas O'Donnell affae806fb
refactor(custom): Add additional logging to the custom module (#1389) 2020-06-26 11:30:11 -04:00
Dario Vladović e034d51cb2
feat(git): honor `GIT_DIR` environment variable (#1348) 2020-06-24 17:13:47 -04:00
Thomas O'Donnell dbe6bdf031
refactor(config): Add additional logging to debug config issues (#1390) 2020-06-24 16:11:05 -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
Dario Vladović d1bbba321b
test(nodejs): add test attribute to omitted tests (#1367) 2020-06-21 17:59:00 +02:00
Dario Vladović b176fc35ac
feat(nodejs): support additional file patterns (#1311) 2020-06-21 10:33:58 +02:00
Daniel A. White b238574100
feat(dotnet): adds additional files to detect .net projects (#1303)
* adds additional files to detect .net projects

* test .net output with a regex pattern
2020-06-21 10:22:20 +02:00
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
anouar kappitou feac3d56ce
fix: replacing default RUST_LOG environement variable with starship specific one, to prevent interlacing (#1280)
Co-authored-by: Kappitou Anouar <anourkappitou@gmail.com>
2020-06-14 20:22:34 +02:00
Thomas O'Donnell 055986e2b1
feat(python): Add option to change the python binary (#1297)
* Add option to change the python binary

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

* Add advanced config section to python module docs

Have added an advanced config section to the python module docs and
moved the `python_binary` option into that section.
2020-06-14 11:27:10 +02:00
Thomas O'Donnell c182572796
Fix PHP version including error messages (#1317)
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.
2020-06-13 01:04:53 +02:00
Munif Tanjim 525dfef9a7
fix(bash): last command status and command duration (#1185)
* fix: character module last command status for bash

* fix: command duration module for bash
2020-06-10 18:53:56 +02:00
Rekihyt fcd003785b
feat(nim): Add Nim module (#1189)
* Nim module and tests

* Add nim to docs

* parse_nim_version refactor, add nim desc

* Add nim symbol to Nerd Font preset

* Yellow with v prefix as default version

* Nim version fmt fix

* Update docs/config/README.md

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

* Update src/modules/nim.rs

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

* Nim module and tests

* Add nim to docs

* Yellow with v prefix as default version

* Update docs/config/README.md

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

* Update src/modules/nim.rs

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

* Add nim to docs, proper version formatting.

* Remove v from symbol, add to fmt string

* cargo fmt

Co-authored-by: Dario Vladovic <d.vladimyr@gmail.com>
2020-06-09 19:14:47 +02:00
Nemo157 fb121cd62a
fix: Retain previous command state on zsh keymap select (#958) 2020-06-09 18:52:29 +02:00
Thomas O'Donnell 5b14f21394
refactor: latest suggestions from Clippy 2020-06-05 23:20:11 -04:00
Nathan West c04a0eb1d1
feat: add shell completion generation command (`starship completions`) (#881) 2020-06-03 11:25:51 -04:00
Samuele Esposito fe2b3d491e
feat(time): Show module with time range (#992)
* 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
2020-05-31 19:43:08 +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
Dario Vladović cf87ce5f50
style(init): tidy-up init scripts (#1269)
* style: fix indent & spacing

* chore: use consistent function definition style

* chore: remove extra semicolon

* chore: flip comparison expression
2020-05-28 12:21:36 -04:00
Grégoire Geis 09996159f4
fix(custom): improve handling of Powershell prompts (#1237)
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.
2020-05-27 09:38:05 +02:00
nobv 63799b97d1
feat(PureScript): Add Purescript module (#1227)
* 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
2020-05-22 18:26:58 +02:00
Dario Vladović c008f4041b
feat: add Zig module (#1231) 2020-05-21 18:49:49 +02:00
Hirochika Matsumoto 9e8f35d746
feat(ocaml): Add OCaml module (#1218)
* Add OCaml module

* Update README.md accordingly

* Fix typo

* Add Reason support

Obtain OCaml version using `-vnum` flag.
Extend conditions to match projects using jbuild, esy
or merlin.

* Update README.md

Co-authored-by: Dario Vladovic <d.vladimyr@gmail.com>
2020-05-21 18:43:13 +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
Karol Fuksiewicz eba4d87612
feat(package): configurable displaying package version for packages marked as private (#1109)
* feat(package): config for enabling package version in private packages

* test(package): refactor package tests
2020-04-28 10:53:30 +02:00
Oisín 8e8519552f
fix(haskell): avoid creating .lock files or downloading GHC (#1147)
* (Haskell) avoid creating .lock files or downloading GHC

* Fix stack command in mock expectations for Haskell module + befriend cargo fmt
2020-04-28 10:07:18 +02:00
Benedikt Reinartz 8c17f7b97c
feat(erlang): Add Erlang module (#1129) 2020-04-27 12:09:42 +02:00
John Letey a3fef5becf
feat: Modify config keys from shell (#1095)
* 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>
2020-04-26 15:58:39 +02:00
Alexandru Macovei decd4e2a5d
fix(haskell): add description for haskell, used by the explain command (#1141) 2020-04-25 14:34:01 +02:00
Alexandru Macovei 2c30f4bd9e
fix(crystal): Add Crystal module to default prompt order (#1140) 2020-04-24 19:37:34 +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
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
Thomas O'Donnell beed0acc6c
fix(python): Fix venv name not showing when using pyenv (#1046)
This fixes an issue where the name of the virtual environment is not
being shown when using the `pyenv_version_name` setting.
2020-04-14 10:23:57 +02:00
Thomas O'Donnell 05e323da75
chore: Add more detailed logging for executing cmds (#1097)
This makes some changes to the logging to make debugging what is
happening a bit easier when we run external commands.
2020-04-13 15:22:28 +02:00
Thomas O'Donnell 391add767f
revert: fix(git_branch,git_status): implement fallback branch_n… (#1092)
This reverts commit 8d90baf0eb.
2020-04-11 16:10:39 -04:00
Grégoire Geis 15dc486e72
Add support for custom modules. (#916) 2020-04-11 18:37:24 +02:00
Jonathan Knapp 19e8301ff1
Fix ruby version to not assume length (#1082) 2020-04-10 18:41:14 +02:00
Zhenhui Xie b11fe2ad30
fix: Fix variable styles in string formatter (#1069)
* fix: Fix styling in variables

* fix: Fix clippy

* fix: Allow passing styles down to segments with no style

* fix: Fix clippy
2020-04-10 18:23:20 +02:00
Udo Kramer d27b263023
feat(package): Add project version for Elixir (#1067) 2020-04-08 18:39:54 +02:00