summaryrefslogtreecommitdiffstats
path: root/src/configs/package.rs
diff options
context:
space:
mode:
authorThomas O'Donnell <andytom@users.noreply.github.com>2021-08-06 21:16:14 +0200
committerGitHub <noreply@github.com>2021-08-06 21:16:14 +0200
commitb7b7df98854b2d4ff9c5f2fdddc796449cdab908 (patch)
treec80814bf0e41351c48892981c0b931f588850698 /src/configs/package.rs
parent3ea425318bd262c287db9346831d41422e976fb8 (diff)
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.
Diffstat (limited to 'src/configs/package.rs')
-rw-r--r--src/configs/package.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/configs/package.rs b/src/configs/package.rs
index 7fe422155..887cda0d0 100644
--- a/src/configs/package.rs
+++ b/src/configs/package.rs
@@ -10,6 +10,7 @@ pub struct PackageConfig<'a> {
pub style: &'a str,
pub display_private: bool,
pub disabled: bool,
+ pub version_format: &'a str,
}
impl<'a> Default for PackageConfig<'a> {
@@ -20,6 +21,7 @@ impl<'a> Default for PackageConfig<'a> {
style: "208 bold",
display_private: false,
disabled: false,
+ version_format: "v${raw}",
}
}
}