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
Command heirarchy/grouping #71
Comments
Candidates:
|
Just to have this on-record: I don't think it's a good idea to promote any other commands, at least for now. We consider these two operations (endpoint search and ls) safe to promote because they operate in terms of one of our fundamental model objects, namely Endpoints. As such, the chances of a conflict with another service are exceedingly low. However, getting back on my high-horse now, I think that requiring calls to a service to be done as explicit commands against that service is a very clean and natural design in the multi-service world. It also maps very well back onto the types of client objects with which a person is likely to interact if they need to move onto the SDK. |
It turns out that this is a lot messier than I thought it would be, for the simple reason that re-attaching commands (my original plan) does not have the right semantics. There is a tutorial on aliasing The most realistic solution for this we can do is a pair of new commands which forward all of their options to the endpoint search and ls commands. That means setting a couple of options to forward arguments (ignore_unknown_options and allow_extra_args), and using Context.forward to pass all arguments through.
It also seems like those options might be set on the sub-context used by the new command? But it's not quite clear how context settings modified at command instantiation time get passed down, so that's not certain. Overall, this is looking like a huge slog for something relatively minor. |
The aliases are constructed in terms of a rename and an existing command object, and assign nearly all of the same attributes to the alias command. The only exception is the name, which is obviously altered in the process. Importantly, this is a type of click.Command, and is not generic enough to safely apply to a Group or MultiCommand -- the attributes for those types are different, and the passthrough of original command attributes to the new command's constructor will not cover the differences. The AliasCommand importantly inherits the original commands params, so it does not need to blindly forward options as unprocessed values. That saves us from some of the concerns over doing that. Make - `globus endpoint-search` -> `globus transfer endpoint search` - `globus endpoint-ls` -> `globus transfer ls` as the first two such aliases. Resolves globus#71
On a hunch, I looked at the way that the parameters themselves are stored on a command object -- as I hoped, they're just an attribute of the command. |
Per notes on the |
Everything in globus_cli.services.transfer moves to one of three locations: Most move to globus_cli.commands Everything in the transfer.helpers moves to a new module at `globus_cli.services.transfer`, some other functionality moves into that module. Line-by-line shlex processing moves to globus_cli.parsing On that last note, fixes globus#103 by inspecting exit status on caught SystemExits. Because this does the dramatic refactor, it's also fair to say this resolves globus#71
Do we want to promote certain commands to be top-level commands? Example: "endpoint search" is currently
globus transfer endpoint search
. Should it beglobus search
?Other commands where this would make sense?
The text was updated successfully, but these errors were encountered: