1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-09-20 18:09:02 +00:00
Commit Graph

51 Commits

Author SHA1 Message Date
David Knaack
0a1235e279
feat(package): support cargo workspace versions (#4161) 2022-07-20 11:17:27 +02:00
Stefano Baghino
3fe6cc023c
feat: Add support for Daml (#4004) 2022-05-26 16:42:31 +02:00
Tom Fleet
1b938fd484
feat(package): Extract package version from PEP 621 compliant pyproject.toml (#3950)
* feat(package): Extract package version from PEP621 pyproject.toml

* Update docs explaining PEP 621 package version

* Only read pyproject.toml once

* Simplify get_pep621_version

* Handle version formatting in get_pyproject_version
2022-05-02 18:44:01 +02:00
Thomas O'Donnell
2a650bfd14
perf(package): only try to read files that exist (#3904)
* perf(package): only try to read files that exist

Have refactored the package module to improve performance. Before this
change the module would try to open every single file that could contain
some package information until it found a valid version. This resulted
in a lot of unneeded disk IO. Have added a new fn, `read_file_from_pwd`
that uses the current context to check if that file already exists and
fast failing if it doesn't. From my local testing this speeds up the
package module from taking ~1ms to ~50µs in an empty directory.

* refactor: move read_file_from_pwd to context

* refactor(haskell): use read_files_from_pwd

* refactor(nodejs): use read_files_from_pwd
2022-04-25 16:18:01 +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
Zhong Liu
295948bc6c
feat(package): support for dart pub version (#3373)
* feat(package): add support for dart pub version

* feat(package): add doc for dat pub version
2022-01-01 23:57:20 +01:00
pejax
1109fd6997
feat: Add package version detection for sbt projects (#3274) 2021-12-03 01:56:06 -05:00
Fred Cox
c1f2d345aa
fix(escaping): move escaping to individual variables (#3107) 2021-11-01 22:18:45 +01:00
vypxl
614e0e2763
feat(package): Add support for crystal shards (#3147)
* add crystal shard (package) version support

* module package: crystal shard version: read shard.yml directly

* module package: add test for crystal shard version

* format src/modules/package.rs

* use yaml-rust instead of serde-yaml

* document shards package support

* Update docs/config/README.md

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2021-10-13 07:42:55 +02:00
Tom Most
bbb8d3c357
fix(package): Ignore setup.cfg attr: and file: (#3054)
The setup.cfg version key allows "attr:" and "file:" directives to load
the actual value from elsewhere [1]. Treat these as if no version was
found, since the text of the directive isn't the version number we're
after.

[1]: https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html#specifying-values
2021-09-14 12:17:05 -05: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
Thomas O'Donnell
b7b7df9885
feat(package): Add ability to format the version (#2959)
Have added the ability to use format the version of the package using
the `version_format` option. While doing this I have also done some
refactoring of the module to remove the if/else if/... block and replace
it with an iterator. This should make fix some edge cases where versions
are not correctly picked up due to other files an example would be a
python project that has a `pyproject.toml` file but using the
`setup.cfg` for the package version. It should also make it easier to
make the order of the list configurable in the future.
2021-08-06 21:16:14 +02:00
David Knaack
af43aeefba
fix(clippy): fix new clippy lints (#2939) 2021-07-29 14:27:46 -04:00
Tom
2fa7f56cec
feat(package): Support package version from setup.cfg (python). (#2890)
* Support package version from setup.cfg (python).

Add an additional package version extraction function to parse
the 'version' attribute under the 'metadata' section in a python
package 'setup.cfg' file.

Also add similar tests from the poetry extraction function to test
the desired behaviour.

This adds a dependency on ConfigParser:
https://crates.io/crates/configparser.

* Clean up comments

* Use rust_ini over ConfigParser

* Add mention to setup.cfg version parsing in docs
2021-07-27 17:58:35 +02:00
Pratik Chaudhary
f3984eaf16
feat(package): add support for nimble project package version (#2569)
* feat(nim): add support for nimble project package version

* Replace find_file with context scanner. Fixes the failing tests.

* Replace `utils::exec_cmd` with `context.exec_cmd` so that it uses
global timeout

* Add tests for nimble project version

* Add docs for nimble in package version module for english language

* Update docs/config/README.md

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>

* Add test for a case when nimble is not available

* Remove extract_vlang_version

I don't know why it did not come up while I was fixing merge conflicts
on rebase.

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2021-05-09 06:38:16 +02:00
Dario Vladović
c4f977c48d
feat(vlang): support vpkg (#2686) 2021-05-07 10:22:18 -04:00
Milo
48f913ec23
feat(vlang): create module (#2577)
* Add V module

* Format

* Fix tests

* fix typo

* Update src/configs/v.rs

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

* Update docs/config/README.md

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

* Update docs/config/README.md

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

* Update docs/config/README.md

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

* Use blue bold

* v -> vlang

* change docs

* More vlang fixes

* add package support for v

* Update docs/config/README.md

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

* use regex

* Update src/configs/mod.rs

Co-authored-by: David Knaack <davidkna@users.noreply.github.com>

* apply patch

* fix

Co-authored-by: Dario Vladović <d.vladimyr@gmail.com>
Co-authored-by: David Knaack <davidkna@users.noreply.github.com>
2021-05-03 21:50:29 +02:00
Tom Golden
c2e84e1802
feat: abbreviate package.json semantic versions (#2271) 2021-04-29 15:06:25 -04:00
Bao, Huang-Huang
8f46dff9dc
fix(package): fix meson version extraction if 'meson_version' is present (#2397) 2021-03-12 15:30:25 +01:00
David Knaack
04d1332f9c
refactor(clippy): fix new lints (#2297) 2021-02-11 21:08:17 +01:00
Alexandru Macovei
499e0357b0 refactor: apply more clippy lints 2021-01-22 11:50:12 -05:00
Hanif Ariffin
5722b17f9e
fix: Applied clippy warnings (#2153)
* Applied changes suggested by clippy

In general:

1. Prefer std::path::Path over std::path::PathBuf
2. Simplified code with string formating...

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>

* Fixed test

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>

* Fixed formatting

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2021-01-16 13:26:52 +01:00
花蛄
4f51ef8db1
feat(package): Meson package support (#2001)
* Add package version support for Meson meson.build.

* Update docs with Meson package version support.
2020-12-19 14:17:34 +01:00
Tilmann Meyer
88b603be38
test: introduce env variable mocking (#1490) 2020-08-07 15:13:12 -04:00
Steve Smith
b14be4dfb1
feat(package): Add Maven pom.xml version support (#1511)
* Add gitignore for Emacs backup files.

* Add package version support for Maven pom.xml.

* Update docs with Maven package version support.

* Fix for clippy.
2020-07-31 09:54:03 +02:00
Simão Mata
1acce65462
feat(package): Add support for Helm charts (#1525)
Signed-off-by: Simão Mata <sm@0io.eu>
2020-07-29 14:06:47 +02:00
Zhenhui Xie
ec76fafff0
feat: refactor modules to use format strings (#1374) 2020-07-07 18:45:32 -04: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
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
Udo Kramer
d27b263023
feat(package): Add project version for Elixir (#1067) 2020-04-08 18:39:54 +02:00
Shu Kutsuzawa
edcec7eed8
feat(package): Add project version for julia (#1036)
* add project version (for julia) to package module

* update docs
2020-04-03 20:16:22 +02:00
Matan Kushner
d0e1904758
feat(package): ignore private JS packages (#975)
`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.
2020-03-05 10:49:11 -05:00
Kevin Lane
ce540fff7a
feat: display Gradle project version (#662)
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.
2020-02-21 14:12:21 -05:00
Tobias Bieniek
ecc8754335 fix(package): Use specified directory instead of current working directory (#774) 2019-12-23 22:38:00 -05:00
Morten Scheel
e38a257656 feat: add composer.json version to Package module (#716) 2019-12-11 21:05:39 -05:00
Thomas O'Donnell
45d977aa39 fix: Remove duplicated "v" in package versions (#648) 2019-11-20 09:16:07 -05:00
Zhenhui Xie
aadd8ecf2c refactor: Refactor modules to use module config (#514) 2019-10-19 10:51:38 +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
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
57e807fec6
style: Fix clippy warnings 2019-08-23 13:13:04 -04:00
Kevin Lane
e262187f4c feat: Display Python package version from poetry (#153) 2019-08-15 16:41:06 -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
Matan Kushner
876e7d36b1
fix: handle package version panic (#57) 2019-05-16 10:06:34 -06:00
Matan Kushner
c6ee5c6ac1
Refactor segments into modules (#40) 2019-05-01 16:34:24 -04:00