Skip to content

Parameterize 'dev' string in pre-release tag (OR allow free formatting?) #45

@needleshaped

Description

@needleshaped

Dear @mdomke, thank you for the tool!

Please consider allowing more flexible formatting of the output string.

  1. Use case: I usually add a branch name to version, and our developers use short dev branch name, instead of develop. Thus, end result is often confusing 1.0.0.dev.1-ce117b4b-dev (using - instead of + because Docker tags are not compatible with semver).
  2. Use case: When explaining to developers as DevOps engineer new proposed versioning scheme based on your project, I often need to mention, that .dev = number of commits since the last commit, which is not self-evident. I would either completeley remove it, or replace with .commit, which would make it self-evident.

I'd like to avoid post-string-replacement (s/.dev/.commit/), thus asking you here.

Essentially it means a new variable for this line


P.S. This may be solved, with making format itself configurable. As of now, you have hardcoded choice of formats.

  • Existing tool that implements it this way, is e.g. date, date +%Y%m%d-%H:%M:%S,
  • This would result in usage: git-semver -format '%X.%Y.%Z-dev.%N+%S'. (%S - SHA)

Such method would also allow other functionality to be easily added, e.g.

  • like branch name %B, while preserving default format intact
  • or making generated version compatible with Docker tags out of the box.
  • will allow to use user-defined $VARIABLES in a format string, which opens complete freedom, without a need of post-processing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions