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
Provide a factory for resource options #161
Conversation
|
WIP: should be used in more places if the design is agreed upon. |
3c664cf
to
7be317a
Compare
|
Should we limit the naming convention to only be used for options where a known resource, i.e. remotes, repositories, content, ..., is being asked for? Basically, should we have a global way to refer to a resource besides that resource's pulp_href? Something like "pulp show --name repository:file:file:foo". Maybe it doesn't make sense since there isn't many other operations we could do across all resources that aren't covered by their specific plugin commands already, but maybe you have some other ideas. Other than that I think the design looks good! |
pulpcore/cli/common/generic.py
Outdated
|
|
||
| def resource_option(*args: Any, **kwargs: Any) -> Callable[[F], F]: | ||
| default_plugin: str = kwargs.pop("default_plugin", None) | ||
| default_type: str = kwargs.pop("default_type", None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
This looks good to me so far. |
7be317a
to
3c40ccd
Compare
2ff31d9
to
bd92fc7
Compare
25bb4f0
to
e009e37
Compare
cdc343d
to
1d59e2a
Compare
7dd5c40
to
e8ce1ad
Compare
4fb0606
to
d748f73
Compare
a991279
to
e45ba89
Compare
Can you add test(s) for this? |
|
Also this needs a rebase. :) |
e2953e5
to
8e760e1
Compare
Tests are added.
Obviously we discourage the use of |
028785b
to
14b1e11
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
[noissue]
The options accept resources by the "[[<plugin>:]<type>:]name" pattern. Fixes pulp#158
14b1e11
to
4565922
Compare
The options accept resources by the "[[:]:]name" pattern.
fixes #158