mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-11-16 18:15:16 +00:00
b7b7df9885
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.
28 lines
671 B
Rust
28 lines
671 B
Rust
use crate::config::ModuleConfig;
|
|
|
|
use serde::Serialize;
|
|
use starship_module_config_derive::ModuleConfig;
|
|
|
|
#[derive(Clone, ModuleConfig, Serialize)]
|
|
pub struct PackageConfig<'a> {
|
|
pub format: &'a str,
|
|
pub symbol: &'a str,
|
|
pub style: &'a str,
|
|
pub display_private: bool,
|
|
pub disabled: bool,
|
|
pub version_format: &'a str,
|
|
}
|
|
|
|
impl<'a> Default for PackageConfig<'a> {
|
|
fn default() -> Self {
|
|
PackageConfig {
|
|
format: "is [$symbol$version]($style) ",
|
|
symbol: "📦 ",
|
|
style: "208 bold",
|
|
display_private: false,
|
|
disabled: false,
|
|
version_format: "v${raw}",
|
|
}
|
|
}
|
|
}
|