1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-06-02 08:30:50 +00:00
Commit Graph

51 Commits

Author SHA1 Message Date
David Knaack
645a439c0b
build(deps): update toml crates (#4853)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-01-30 23:12:27 +01:00
David Knaack
6ac5df904b
refactor: replace ansi_term with nu_ansi_term (#4339) 2022-09-04 18:44:54 +02:00
David Knaack
2d4b183fce
refactor: replace module_config_derive with serde (#3786)
* refactor: replace module_config_derive with serde

Changes include:
* Removing `starship_module_config_derive` and replacing it with `serde::Deserialize`
* Removing `RootModuleConfig::load_config`. While potentially useful, it was only used in tests. And it would require something like `serde::DeserializeSeed` which is not derived by serde.
* Merging `RootModuleConfig` into `ModuleConfig`
* Implementing a `ValueDeserializer` that holds a reference to a `toml::Value` in `serde_utils.rs`
* Deserialization errors (invalid type) are now logged and include the current key and the struct names
* Unknown keys are now considered an error. "Did you mean?"-messages are still possible

* fix typo

Co-authored-by: Matan Kushner <hello@matchai.dev>

Co-authored-by: Matan Kushner <hello@matchai.dev>
2022-03-26 10:42:19 +01:00
cbolgiano
8d80d2ef06
feat(python): Show value of PYENV_VERSION when present (#3144)
* 2872: Show value of PYENV_VERSION when present

* 2872: Run cargo fmt
2021-11-09 21:55:53 +01:00
Fred Cox
c1f2d345aa
fix(escaping): move escaping to individual variables (#3107) 2021-11-01 22:18:45 +01:00
filip
1c9758f08b
style: Improve modules consistency (#3006)
* cmake - consistent parse version method names

* crystal - consistent parse version method names

* dart - consistent parse version method names

* deno - consistent parse version method names

* golang - consistent parse version method names

* helm - consistent parse version method names

* implement get_command_string_output, java - consistent parse version method names & small refactor

* julia - consistent parse version method names

* kotlin - consistent parse version method names and refactor

* lua - consistent parse version method names and refactor

* implement get_command_string_output for scala

* format crystal module

* remove outdated comment

* node use format_module_version

* terraform - consistent parse version method names

* vagrant - consistent parse version method names

* format

* refactor python module

* improve rlang module consistency

* fix clippy warning
2021-08-25 10:41:10 -05:00
filip
b1db771baa
fix(rlang): module not working on MacOs (#2880)
Fix rlang module and refactor other modules to use new method.
2021-08-02 13:13:29 -04:00
filip
540c2c2475
feat: Add version formating for modules (#2611)
* format crystal version with VersionFormatter

* update crystal dosc

* format crystal module

* fix typos

* format dart version with VersionFormatter

* fix dart malformed test

* update dart docs

* format cmake version with VersionFormatter

* update cmake docs

* format deno version with VersionFormatter

* update deno docs

* remove Version type

* format dotnet version with VersionFormatter

* update dotnet docs

* format erlang version with VersionFormatter

* update erlang docs

* format golang version with VersionFormatter

* refactor formatting in my modules

* format helm version with VersionFormatter

* format julia version with VersionFormatter

* format kotlin version with VersionFormatter

* format lua version with VersionFormatter

* format nim version with VersionFormatter

* format perl version with VersionFormatter

* format php version with VersionFormatter

* format purescript version with VersionFormatter

* format scala version with VersionFormatter

* format swift version with VersionFormatter

* format terraform version with VersionFormatter

* format vagrant version with VersionFormatter

* format zig version with VersionFormatter

* format elixir version with VersionFormatter

* format ocaml version with VersionFormatter

* update elixir docs

* update golang docs

* update helm docs

* update julia docs

* update kotlin docs

* update lua docs

* update nim docs

* update ocaml docs

* update perl docs

* update php docs

* update purescript docs

* update scala docs

* update swift docs

* update terraform docs

* update vagrant docs

* update zig docs

* format elm version with VersionFormatter

* update elm docs

* pass module_name as &str to format_module_version
2021-04-29 23:22:20 +02:00
Dario Vladović
fe030c2064
refactor: propagate version formatting errors (#2566)
* refactor: propagate version formatting errors

* refactor: trim version formatting boilerplate

* refactor(node): unwrap version formatting

* docs: fix typo

* docs: remove dots after `version_format`

* feat: lazy version parsing

* refactor(version-formatter): collect segments into string
2021-04-10 19:06:25 +02:00
Chris Rose
6817e7f698
feat: add version format configuration (#2499) 2021-04-08 18:37:54 -04:00
Charles Swartz
2b0010ffe3
feat(python): Remove parentheses from pyvenv.cfg prompt parameter (#2551)
* Remove parentheses from pyvenv.cfg prompt

* Apply suggestions from initial code review

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

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>
2021-04-05 16:51:01 +02:00
Chris Rose
aa7a8056bb
fix: Add a missing ' ' to the end of the python prompt (#2248)
Co-authored-by: Chris Rose <offline@offby1.net>
2021-03-24 10:41:08 -05:00
Asger Hautop Drewsen
d2946ddff7
fix(python): Handle PyPy python version correctly (#2374)
* fix(python): Handle PyPy python version correctly

* refactor: rework Python version retrieval and formatting

Align Python version retrieval and formatting with established
Starship conventions.
2021-03-14 19:27:19 +01:00
David Knaack
eccbda8328
feat: allow changing default command timeout (#2283)
* feat: allow changing default command timeout

* fix clippy

* add doc to exec_cmd in Context

* update docs in CONTRIBUTING.md

* Fix comment in CONTRIBUTING.md

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

Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2021-02-11 21:34:47 +01:00
Thomas O'Donnell
da4bd401c4
feat(python): Configure when the module is shown (#2264)
This makes it possible to configure when the python module is shown
based on the contents of a directory. This should make it possible to
be a lot more granular when configuring the module.

This includes a breaking change since we are removing the
`scan_for_pyfiles` configuration option in favour of setting the
`detect_extensions` to an empty array.
2021-02-07 22:18:52 +01:00
Moritz Vetter
e437a463ac
perf(python): Lazy eval of python version command (#2158)
* perf(python): evaluate version lazily

* fix(python): update format string

* fix: use suggested format strings

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

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
2021-01-20 18:42:55 +01:00
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
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
Thomas O'Donnell
bb324834a5
fix: restore the pyenv_prefix option to python (#1668)
Have restored the `pyenv_prefix` option to the python module. This is
added as a new variable that will only be shown if `pyenv` is being used
to determine the version of python that is being used.
2020-09-21 11:48:26 -04:00
Tilmann Meyer
88b603be38
test: introduce env variable mocking (#1490) 2020-08-07 15:13:12 -04:00
Zhenhui Xie
ec76fafff0
feat: refactor modules to use format strings (#1374) 2020-07-07 18:45:32 -04: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
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
Peter Bull
b723a7d562 fix(python): Trim "Anaconda, Inc." from version (#861) 2020-01-21 11:14:40 -05:00
Thomas O'Donnell
edc62f4518 refactor: Refactor modules to use the exec_cmd util (#676)
Have refactored the golang, java, nodejs, python, ruby and username
modules to use the new `exec_cmd` util.
2019-12-02 17:42:55 -05: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
Thomas O'Donnell
7b9197a67e fix: Fix the python module ignoring error codes (#563)
This is a quick fix to stop the python module from displaying error
messages that have been printed to stderr as the version.
2019-10-20 17:42:27 +09:00
Zhenhui Xie
aadd8ecf2c refactor: Refactor modules to use module config (#514) 2019-10-19 10:51:38 +09:00
Nguyễn Hồng Quân
27fad02837 fix: Separate Python version string and env name (#548) 2019-10-17 18:55:48 +09:00
Matan Kushner
05210b9510
refactor: Go from Rust workspaces to a package with nested packages (#480) 2019-10-04 22:30:46 +09:00
Zhenhui Xie
dd0b1a1aa2 refactor: Refactoring config (#383)
This PR refactors config and puts configuration files for all modules in `configs/`.
2019-09-30 21:10:35 +09:00
Thomas O'Donnell
653def05f0 Enable the python module for tox files (#369)
Enable the python module if the current directory contains a `tox.ini`
file.
2019-09-15 12:21:40 -04:00
Nick Young
7e891f17c1 perf: Lazy load files from directory (#335)
Changes context to use `once_cell` to lazily evaluate directory listing on first use.
2019-09-14 09:23:53 -05:00
Neil Kistner
9f70ffb7a7 fix: Lazy load git repo and only run module if not disabled (#306)
A couple of optimizations are done in this PR. One, we now will check config ahead of time to see if a module is disabled before running any module code. Also, we won't try to discover a git repository unless the module requests access to it.
2019-09-09 19:14:38 -04:00
Kevin Song
9721666d33
feat: Add the ability to configure per-module color styles (#285)
Add parsing logic, config support, docs, and integration with other modules 
for custom styling of each module.
2019-09-07 19:33:06 -05:00
Matan Kushner
e66d7bae1c
ci: Migrate CI from Azure Pipelines to GitHub Actions (#233)
Migrated CI from Azure Pipelines to GitHub Actions.
Until the release process is figured out in Actions, we'll stick to using Azure pipelines for releases.
2019-09-04 19:13:53 -04:00
Thomas O'Donnell
1478f8c2e9 Add support for detecting Python from Pipenv files (#221)
Added the ability to enable the Python module based on the existence of the a `Pipfile`.
2019-08-21 15:54:22 -07:00
Shu Kutsuzawa
d90c43b8b1 feat: Display Vi mode as PROMPT (#169)
Add Vi-mode indicator for zsh
2019-08-17 12:33:19 -07:00
MaT1g3R
160a79fa06 feat: Implement configuration to display pyenv version name (#140)
This behavior can be enabled via setting `use_pyenv` to true.
The "pyenv" prefix before the version name can be configured using `pyenv_prefix`.
2019-08-12 21:12:55 -04:00
MaT1g3R
3669e389b6 feat: Implement Python virtual environment display (#137) 2019-08-11 17:51:13 -04:00
Matan Kushner
f40f73dc8e fix: Address longstanding linter errors 2019-08-05 11:05:08 -04:00
Tiffany Le-Nguyen
08cf33522a docs: Add vuepress with initial docs (#99)
Co-authored-by: Tiffany Le-Nguyen <tlenguyen@expedia.com>
Co-authored-by: Matan Kushner <hello@matchai.me>
2019-07-19 16:18:52 -04:00
Matan Kushner
77ba97df19
chore: Refactor getting string values from config (#94) 2019-07-14 11:15:47 -04:00
Matan Kushner
463ec26024
feat: Add a disabled configuration option for modules (#86)
• Add support for the disabled configuration option
This will allow you to selectively disable modules that you don't want or need. 😄
• Overwrite starship configuration file path with STARSHIP_CONFIG environment variable
• Write tests for the two configuration options that are available
2019-07-02 16:12:53 -04:00
Matan Kushner
097f1b05f1
Add support for prompt configuration (#62)
- Create `Config` struct that is added to `Context` when initialized
- Read `~/.confg/starship.toml` during initialization (can be updated later to also look at `$XDG_CONFIG_HOME`)
- `Context` now has a method for creating modules. This allows us to provide modules with a reference to the configuration specific to that module
2019-06-10 15:56:17 +01:00
John Letey
4cd98d862d fix: Check both stderr and stdout for Python version (#66)
* fix python version not showing for version < 3.4

* make review changes
2019-05-27 02:28:14 -04:00
Tim Mulqueen
5fd715e7c3 Implement directory scanner (#34) 2019-05-12 13:37:23 -04:00
Matan Kushner
c6ee5c6ac1
Refactor segments into modules (#40) 2019-05-01 16:34:24 -04:00
Matan Kushner
9a352c0acc
Add the Git branch segment (#32)
Added
- Repository to Context for reuse in directory and git_branch
- git_branch to prompt

Changed
- Made segments bold to match spaceship
2019-04-26 22:07:07 -04:00