Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic versioning handling through SwiftPM plugin #567

Open
kiliankoe opened this issue Apr 18, 2023 · 1 comment
Open

Automatic versioning handling through SwiftPM plugin #567

kiliankoe opened this issue Apr 18, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@kiliankoe
Copy link

kiliankoe commented Apr 18, 2023

Hi,

it's always felt a bit weird to me to have to manually hardcode and maintain the version number as part of my main command, e.g.

@main
struct Command: ParsableCommand {
    static let configuration = CommandConfiguration(
        // ...
        version: "1.0.0",
        // ...
    )
}

I'd typically have my version stored in git tags and the string here and it's a (admittedly) minor pain if I forget to update the version in code and only update the tag.

Swift Package Manager plugins now offer the ability of generating code at compile-time and thus also generate this version information based on the available git repo metadata. There are some packages that already that do just that (see for example here, here, and here). It would be great however to have such a plugin built directly into and distributed as part of swift-argument-parser so that I could optionally automatically reference a version string pulled from my git repo there.

Thanks for considering!

@natecook1000 natecook1000 added the enhancement New feature or request label May 1, 2023
@natecook1000
Copy link
Member

Hi @kiliankoe, thanks for the suggestion! It seems like there are so many different ways of managing version numbers that it would be hard to provide all that flexibility in this particular package. From what I can see, all three of those plugins that you referenced would integrate well with ArgumentParser's CommandConfiguration.version setting, but each one uses a different way of generating and surfacing the package/project metadata! I think having other package supply that information is probably the right situation right now.

If you have a proposed design or more information about a standard way of providing versioning information, I'd be happy to discuss further!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants