From b7b7df98854b2d4ff9c5f2fdddc796449cdab908 Mon Sep 17 00:00:00 2001 From: Thomas O'Donnell Date: Fri, 6 Aug 2021 21:16:14 +0200 Subject: 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. --- src/configs/package.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/configs/package.rs') 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}", } } } -- cgit v1.2.3