Skip to content

Allow users to bring their own template #165

Closed

Description

@sahidvelji

To maximize flexibility in code generation, allow a user to write their own template and supply the path to the template when using the generate command. This way, users are not bound to the existing templates such as https://github.com/open-feature/cli/blob/main/internal/generators/golang/golang.tmpl.

Activity

  1. beeme1mr commented on Sep 29, 2025

    @beeme1mr
    Member

    This sounds like a good idea to me. I'd expect the implementation to be relatively straightforward. What did you have in mind for the subcommand? Something like openfeature generate custom --template ./cobal.tmpl

  2. sahidvelji commented on Sep 30, 2025

    @sahidvelji
    ContributorAuthor

    I don't think a subcommand is needed in this case. We could just add a new flag. Something like this:

      --template string   Path to a custom template. If not specified, the default template is used.
    

    Usage:

    openfeature generate go --template ./openfeature-go.tmpl
  3. sahidvelji commented on Oct 11, 2025

    @sahidvelji
    ContributorAuthor

    We should also have documentation that provides guidance on how to write a custom template.

  4. twu commented on Jan 7, 2026

    @twu
    Contributor

    @sahidvelji 👋 I took a stab at supporting custom templates via --template flag. Hope this is okay. See #198

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions