Commit Graph

429 Commits

Author SHA1 Message Date
Thomas O'Donnell
cf8a6d0738
feat(python): Smarter python binary usage (#1947)
Update the python module to try multiple python binaries when
determining the version. With the new logic if starship doesn't find
`python` on the `PATH`, which is the default for some Linux Distros, it
will fallback to `python3` and then `python2`.
2020-11-30 13:14:18 -06:00
Dominik Nakamura
abfe4324e0
feat(rust): Support new rust-toolchain format (#1938)
* feat(rust): Support new rust-toolchain format

* Match file parsing with rustup and update link

* Use cargo to deserialize the rust-toolchain file

* Filter empty channel strings after extraction

* Use the option value instead of rewrapping
2020-11-30 13:52:55 +01:00
Zane Shelby
389e006c00
feat(java): Show Java module for Clojure projects (#966) 2020-11-30 13:50:56 +01:00
Gabriel de Perthuis
3dfe4ca932
fix(git_state): Handle gitdir indirection when rebasing (#1744)
* Make git_state more robust

No need to come up with fake progress info.

See #1374, #1761.

* git_state: add support for .git indirection when rebasing
2020-11-26 19:56:18 +01:00
David Knaack
0f483fad2b
perf(memory_usage): replace sysinfo with sys-info (#1886)
* perf(memory_usage): replace sysinfo with sys-info

* format

* simplify error handling
2020-11-23 21:17:15 -05:00
Sagittarius-a
688f1b3457
feat(git_branch): add remote branch name if different than local branch (#1915)
* feat(git_branch): add remote branch name if different than local branch

* feat(git_branch): Implement a more customizable remote branch

* feat(git_branch): Use more explicit API function name

* feat(git_branch): Remove forgotten draft documentation

* feat(git_branch): Set less verbose defaults

* feat(git_branch): Handle case to always display remote

* feat(git_branch): Fix error in rebase operation
2020-11-23 22:07:16 +01:00
David Knaack
cf297ff25d
fix: apply nightly clippy & fmt suggestions (#1922) 2020-11-23 20:38:11 +01:00
Aaron Gable
4b85b40cb0
feat(git_branch): add 'only_attached' config bool (#1910)
* feat(git_branch): add 'only_attached' config bool

This adds a new boolean, `only_attached`, to the configuration for
the `git_branch` module. This mirrors the `only_detached` config
value for the `git_commit` module: setting the value to true causes
the module to suppress its output when the user is not on a branch.

This allows users to have either a branch name or a commit hash in
their prompt, as opposed to having either a branch name or the
overly-wordy "HEAD (sha1)".

* Fix formatting
2020-11-23 19:22:51 +01:00
Masashi Aso
eb4e59d9ea
fix(swift): parsing swift version (#1913)
* fix parse swift version for swift-for-tensorflow

* add test for parsing swift version

Co-authored-by: Masashi Aso <maashi.apple.japan@icloud.com>
2020-11-20 19:34:27 +01:00
Adham
ac88301294
feat(terraform): Add hcl extension support to Terraform module (#1875)
* Add hcl file extension to terraform module

Signed-off-by: adhaamehab <adhaamehab.me@gmail.com>

* Update docs

Signed-off-by: adhaamehab <adhaamehab.me@gmail.com>
2020-11-14 18:33:21 +01:00
David Knaack
a05be18447
fix(pwsh): fix crash on error in shell with old pwsh (#1861)
Handle missing Get-Error in powershell gracefully.
2020-11-12 10:42:03 -06:00
David Knaack
be882fcda9
fix(windows): configure console to enable ANSI support (#1646) 2020-11-11 20:24:43 +01:00
David Knaack
35a0a20f5c
perf(init/pwsh): use get-random for session-key instead of invoking starship session (#1860) 2020-11-08 11:07:25 +01:00
Gautham Warrier
7450510327
perf(init): use $RANDOM env-var instead of starship session to generate session-key (#1755) 2020-11-07 16:30:08 +01:00
Jamie Kirkpatrick
3846070efa
fix(gcloud): respect overides of the active gcloud config (#1846) 2020-11-05 18:47:58 +01:00
David Knaack
ffac28745b
fix(bug-report): verify exit code of open, always print url (#1839)
* fix(bug-report): verify exit code of browser open

* always print url to open ticket
2020-10-30 18:36:12 +01:00
Shu Kutsuzawa
c6d25a6a38
feat(lua): Add a Lua module (#1815)
* feat: add lua module

* docs: add lua module

* fix: lua version test

* feat: lua module can be detected if the current dir contains a "lua" dir

* feat: enable to use luajit

* fix: improve regex

* fix based on https://github.com/starship/starship/pull/1815#discussion_r510932742

* fix based on https://github.com/starship/starship/pull/1815#discussion_r511362581

* fix based on https://github.com/starship/starship/pull/1815#discussion_r510941252
2020-10-27 19:05:20 +01:00
Gautham Warrier
f0cc2bea79
fix(zsh): Ensure existing keymap change functions are not overriden (#1826) 2020-10-27 19:01:52 +01:00
David Knaack
b9c096bd56
feat(logger): don't create empty log files (#1836) 2020-10-27 19:00:53 +01:00
Christoph Schlosser
89fc93d1f9
feat(cmake): Add CMakeCache.txt detection to CMake module (#1795)
* Add CMakeCache.txt to cmake module

* Remove trailing whitespace

* Apply fixes by @andytom

* Add CMakeCache.txt to docs

* Revert documentation for languages other than en
2020-10-25 19:10:42 +01:00
Mauricio Teixeira
eec961caaf
feat(openstack): Add module for OpenStack (#1664)
* first (crude) attempt to implement the openstack module

* Attempt to follow OpenStack standards for clouds.yaml location

* fmt

* provide unittest

* add documentation

* fix fmt

* fix clippy

* fix clippy

* fix fmt

* fix small nitpicks

* expand openstack explanation

* load config file using find_map

* fix fmt

* add test for valid config, plus fix test for invalid config

* fix fmt

* re-add forgotten comment
2020-10-24 11:46:43 +02:00
marcos-quezada
745a554fdc
fix(pwsh): Switched pwsh profile to use dollar hook for a more accurate success/failure handling (#1745)
* [f]Use_global_dollar_hook_for_lastExitCodeForPrompt Switched to use the dollar hook, as source of truth for exit code of las command, included comments to clarify.

* fix: Adjusted accordingly to comments on PR.

* fix: Moved last exit code handling inside  if to reuse that variable.

Co-authored-by: Marcos Quezada Perez <marcos.quezadaperez@peakwork.com>
2020-10-24 11:18:58 +02:00
Miguel Ángel Melón Pérez
ea9f803018
feat(git_commit): add git tag to module (#950) 2020-10-23 11:49:19 -04:00
Thomas O'Donnell
c938eac1d6
fix(kubernetes): Parse stacked kubeconfigs (#1678)
Have refactored the kubernetes module to better support stacked
kubeconfigs. Rather than trying to grab both the current-context and
namespace on a single pass we now do two passes. These changes should
fix the problems where the current-context is defined in one file but
the context and the namespace are defined in a different file.
2020-10-23 13:39:50 +02:00
David Knaack
daf7976f9d
fix(pwsh): preserve original console encondings (#1810) 2020-10-19 13:52:15 -04:00
Thomas O'Donnell
035e80bbd3
chore(context): Use monotonic clock for timeout (#1802)
Have switched to use a monotonic clock for calculating the timeout when
indexing the current directory for the context to avoid any issues with
calculating the timeout when the systems clock might change.
2020-10-17 15:36:21 -04:00
jRimbault
95bb901b8a
chore: fix the double compiling of lib and bin (#1616)
* fix: rust modules are compiled twice

The modules being declared both in the _library_ crate and the _binary_
crate made cargo compile everything twice:

1. for the library
2. for the binary

What happened was:

1. The library "starship" was compiled.
2. The binary "starship" (and all its modules) were compiled.

* fix: stop compiling every rust module twice

restrict visibility

* Run cargo fmt

* Add bug_report module

Co-authored-by: Matan Kushner <hello@matchai.dev>
Co-authored-by: Kevin Song <chips@ksong.dev>
2020-10-17 11:09:27 +02:00
Thomas O'Donnell
c3cc6b174f
test(aws): Ignore tests that check .aws files (#1775)
When running the AWS module it will parse the AWS config found in
`~/.aws/config` to get the region. This means that tests that expect no
region to be set will fail if there exists a default profile with a
region set, which is probably true for most AWS users. To avoid this
have set the AWS tests that depend on the non-existance of a
`.aws/config` to be ignored.
2020-10-14 12:21:35 -04:00
Thomas O'Donnell
b2a5c4a3e4
chore(log): Add context to logger failure messages (#1764)
Have added a little bit more context to the error messages that occur
when if starship is unable to setup the logger. This should hopefully
make it a bit easier to work out why starship can't setup the logger.
2020-10-14 12:13:44 -04:00
David Knaack
205fd1abdd
fix(git_state): remove unwrap in describe_rebase (#1761) 2020-10-14 12:13:08 -04:00
SarthakSingh31
a73d7140eb
perf(git_status): Improved git_status module performance (#1777) 2020-10-14 12:12:41 -04:00
Matan Kushner
783eb3373d
fix: replace emoji for cmake and erlang (#1787) 2020-10-13 18:01:35 -04:00
David Knaack
4de9e43cff
fix(directory): preserve substitution order (#1782) 2020-10-13 15:06:41 -04:00
Tilmann Meyer
d1e2c13a7c
fix: apply clippy suggestions (#1756) 2020-10-13 12:03:33 -04:00
Tomer
a9f6d0f81e
fix(python): Read venv prompt from pyvenv.cfg (#1747)
*  Add  --prompt rendering to python virtualenv

* Use pyvenv.cfg to find prompt

* Remove usage of VIRTUAL_ENV_PROMPT variable

Seeing how both venv and virtualenv set a pyvenv.cfg, this isn't needed.
Additionally pyvenv.cfg is set in earlier versions than VIRTUAL_ENV_PROMPT,
which at this moment is in the unrelased python 3.10

* Smarter result unwrapping thanks to clippy
2020-10-08 09:58:00 +02:00
David Knaack
7c941af11a
feat(directory): strip Microsoft.PowerShell.Core\FileSystem:: prefix on windows (#1732) 2020-10-06 09:44:27 +02:00
Jeremy Hilliker
1673d565f4
feat(directory): add ellipsis to truncated paths (#1563)
Adds ellipsis in front of truncated paths: …/
Configurable through new config option: directory.truncation_symbol
Fixes #1162, #1626
2020-10-03 11:25:21 -05:00
Logan Magee
2693d125a8
fix: Pass --no-gpg-sign to git commit in tests (#1718)
Some users have commit.gpgSign set to true in their global git config,
causing tests which run `git commit` to fail if the configured
user.signingKey is not present (as is often the case with PGP smart
cards). Passing this flag overrides the global git configuration,
preventing git from attempting sign the specified commit. This change
has no effect on users who haven't set commit.gpgSign to true.
2020-10-03 12:22:19 +02:00
Thomas O'Donnell
0883ad78cf
fix(utils): reduce log level of errors in utils. (#1730)
Have reduced the log level when we fail to execute a command since this
is happening a lot more that expected, for example if a user checks out
a repo that contains a `.js` file but they don't have node installed.
2020-10-03 11:58:49 +02:00
David Knaack
b633248606
fix(readonly): change module to match docs (#1728) 2020-10-02 13:10:46 -04:00
David Knaack
f7f59cd996
fix(bug-report): use correct path for ion config (#1726) 2020-10-02 12:45:23 -04:00
David Barnett
7241f4fbf7
test(git-state): tests failing when git init.defaultBranch set (#1692)
The tests for git-state assume the default branch is `master`.
In git 2.28 support for a global option, `init.defaultBranch`, to
change the default branch name which causes git-state tests to fail.
2020-10-01 19:08:31 +02:00
aspen
7c15b26ac9 fix: Fix compilation on iOS targets 2020-09-30 18:28:19 -04:00
Tilmann Meyer
2650dc8f3f
fix(powershell): fix session key syntax error (#1697) 2020-09-30 12:14:10 -04:00
dependabot-preview[bot]
83502a08dd
build(deps): bump os_info from 2.0.8 to 3.0.0 (#1688)
* build(deps): bump os_info from 2.0.8 to 3.0.0

Bumps [os_info](https://github.com/stanislav-tkach/os_info) from 2.0.8 to 3.0.0.
- [Release notes](https://github.com/stanislav-tkach/os_info/releases)
- [Changelog](https://github.com/stanislav-tkach/os_info/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stanislav-tkach/os_info/compare/v2.0.8...v3.0)

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

* Upgrade to work with the new os_info

Have switched to work with the new os_info tooling.

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Thomas O'Donnell <andy.tom@gmail.com>
2020-09-29 17:06:45 -04:00
Matan Kushner
59f939e25c
chore: update v0.45.0 removal notice (#1687)
* chore: update deprecation notice

* Add deprecation page to sidebar

* Replace the use of "deprected" with "removed"
2020-09-29 12:35:11 -04:00
Tilmann Meyer
2233683410
feat: add error messaging (#1576)
This creates a custom logger for the log crate which logs everything to a file (/tmp/starship/session_$STARSHIP_SESSION_KEY.log) and it logs everything above Warn to stderr, but only if the log file does not contain the line that should be logged resulting in an error or warning to be only logged at the first starship invocation after opening the shell.
2020-09-28 16:38:50 -04:00
Jan Katins
c93bd7b705
fix: actually disable per default disabled modules (#1677)
The default `disabled: true` is actually only available within the module (when the config struct is used and not the user toml) but not all (the hg_branch) modules checked it there again.

Document this in all places and add the check (+ test) to the hg_branch module.
2020-09-26 09:35:41 +02:00
Jan Katins
ffb1345052
feat(status): add the status module (#1651)
* add the exit code module

this allows to display more precisely the last command exit code
and to configure starship to not change the last charcter of the
prompt even in case of failure. It is disabled by default, because
it seems a bit redundant with the character module in its default
configuration.

* rename exit_code module to status

* Enforce a default disabled=true 

In the outer places, we only check for the disabled flag in the config toml file, only when this is loaded into the real config struct, we see the default. And if the default is true, we have to abort at that place. For status and hg_branch that wasn't so. I also commented the rest

* fix spaces in markdown table for status module

* Add a tip that status module is disabled by default

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

* Remove unrelated changes for default disabled=true

Co-authored-by: Gaëtan Lehmann <gaetan.lehmann@gmail.com>
Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2020-09-26 00:04:51 +02:00
Tilmann Meyer
a245d54cdb
fix(git-state): Fix discrepancy between v0.44.0 and master (#1672) 2020-09-21 15:17:06 -04:00