tfausak / cabal-gild

:crown: Format Haskell package descriptions.
https://hackage.haskell.org/package/cabal-gild
MIT License
47 stars 5 forks source link

Increment Package Version Pragma #102

Closed BebeSparkelSparkel closed 2 months ago

BebeSparkelSparkel commented 2 months ago

Being able to specify how to increment the package version would be useful for ci managing pull requests.

Pragma increment-version [version-index] where the optional version index specifies the version number (major, minor, ...) to be incremented. When cabal-gild is run

If the version index is not specified and the new --no-increment-version flag is not given to the cabal-gild command, then cabal-gild should have a non-zero exit. The --no-increment-version allows the other features of cabal-gild to be run without incrementing the version or having the command fail if no version index is specified.

For example with the cabal file

-- cabal-gild: increment-version 0
version: 0.0.0.1

running

$ cabal-gild --io=*.cabal
new-version: 1.0.0.1

the new version would be printed to stdout (shown above)

and the cabal file would be changed to

-- cabal-gild: increment-version
version: 1.0.0.1

Solves the issue specifed in https://github.com/snoyberg/mono-traversable/issues/238

tfausak commented 2 months ago

I don't understand how this pragma is any better or different than simply changing the version number directly.

Aside from that, I think this is beyond the scope of what I want Gild to do. This type of "bump version" command really belongs in the build tool (like cabal bump major), or it belongs in a tool specifically meant for changing precise parts of the package description (like some hypothetical cabal-edit version 1.2.3.4). A principled approach to that requires something like https://github.com/haskell/cabal/issues/7544.

BebeSparkelSparkel commented 2 months ago

I think you are right that this is out of scope.