The Wayback Machine - https://web.archive.org/web/20200920215908/https://github.com/urfave/cli/issues/1182
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

v2 feature: Per-Command Metadata #1182

Open
imle opened this issue Sep 3, 2020 · 1 comment
Open

v2 feature: Per-Command Metadata #1182

imle opened this issue Sep 3, 2020 · 1 comment

Comments

@imle
Copy link

@imle imle commented Sep 3, 2020

Checklist

  • [Yes] Are you running the latest v2 release? The list of releases is here.
  • [Yes] Did you check the manual for your release? The v2 manual is here
  • [Yes] Did you perform a search about this feature? Here's the Github guide about searching.

What problem does this solve?

Writing a Command to be used across multiple Apps is a code reuse pattern that I am sure many benefit from. Currently it is possible to do so as long as you write the Command to be agnostic of the app calling it, which is generally a good practice anyway. However, in an ecosystem of micro-services all defining an App for themselves with a set of base functionality, it is difficult to take advantage of the App's metadata field since the Command is not sure which App or Apps it may be registered against. Providing a metadata field on commands would allow for a set of applications to take advantage of a single Command definition and the underlying App can see the Command's metadata to perform actions like keeping a task running in the background that is requested by the Command.

Solution description

I propose that the Metadata field defined on the App struct be copied to Command struct to allow for situations like this.

Describe alternatives you've considered

No other alternative has been evaluated due to the simplicity of this approach.

@imle
Copy link
Author

@imle imle commented Sep 3, 2020

A PR (#1174) was put in for this functionality and it was suggested that I elaborate further in a feature request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant
You can’t perform that action at this time.