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

Create Template from Interface so users can define their own templates #83

Open
iamkirkbater opened this issue Jul 14, 2023 · 1 comment · May be fixed by #84
Open

Create Template from Interface so users can define their own templates #83

iamkirkbater opened this issue Jul 14, 2023 · 1 comment · May be fixed by #84

Comments

@iamkirkbater
Copy link

Hi there!

I'm proposing a change to cobra-cli that would allow this command to find some way to make the tpl package more customizable.

Use case:

We have a CLI that our dozen+ person team all contributes to in order to be more effective at our jobs. This has made this cobra CLI to become incredibly complex through organic growth. The way we declare our arguments has deviated from the base template that's provided, and we have extended the Command interface to better suit our use case through inheritance. With those changes (which are slowly being rolled out to our codebase) I think it would be nice to be able to use this command utility with a custom template defined within our codebase for how a "new empty command" should look like, compared to our current workflow of copying a "simpler" command file, and trying to change all of the things to get it working.

Ideally - there would be some pre-defined directory or file within the root of a cobra-based project that would declare the templates, and then only if that file is present the cobra-cli tool would automatically default to using that template for new commands rather than the one defined within the tpl package inside this repo.

I'm more than happy to work on building out this feature, if you like the idea.

Thanks for your consideration,
Kirk

@iamkirkbater iamkirkbater linked a pull request Jul 14, 2023 that will close this issue
@iamkirkbater
Copy link
Author

I'm not sure if it's worth expanding this to the project initialization or the main command templates - mostly because I don't see those being used after a project has significantly grown. I'd be happy to extend this functionality in the PR to those other flows though, if desired for more advanced users and use-cases.

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

Successfully merging a pull request may close this issue.

1 participant