Skip to content

Automatic versioning handling through SwiftPM plugin #567

@kiliankoe

Description

@kiliankoe

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions