-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
ui: merge --to-remote and --remote for add and import-url #5721
Conversation
Re: failing CI checks: The failing test seems unrelated and was failing for me locally before making any changes. Likewise, the lint error comes from a warning on a file I didn't touch. |
@alopezz, please rebase. This has been fixed in the master. |
Thanks @alopezz! Quick questions (cc @jorgeorpinel ):
|
Yeah, but the issue and some of the comments it refers to imply that consistency is not a good enough reason not to do this merge. |
thanks!
my 2cs - it can be a reason to avoid this change unfortunately. It can break existing workflows, it also makes a "happy path" a bit more complicated for
yep. I haven't had time to read all the comments unfortunately. I agree though that consistency alone is not enough. |
This actually sounds reasonable, options without a fixed number of arguments do have caveats. Though FWIW, If we want to avoid repetition and the need to special case the
Which still sacrifices consistency with other commands that have |
What about always requiring the remote name? Even the "happy path" of |
sounds reasonable, with one caveat to keep in mind. Not a deal breaker for this "advanced" command I think. So, I don't have a strong opinion on this. |
If it's impossible for the CLI to understand that an invalid option arg is in fact the next cmd arg, then we can make sure the docs examples use the correct order and mention
I'd also argue it is more or as natural e.g.
I though you agreed to merge them per #5198 (comment). But no strong opinion either. I guess if it complicates the UI then the benefit of this effort is questionable.
OR best of both worlds, keep $ dvc add -r /path # adds /path to the default remote
$ dvc add /path -r # same
$ dvc add --to-remote myrem /path # adds /path to myrem
$ dvc add /path --to-remote myrem # same
$ dvc add --to-remote /path
ERROR: '/path' is not a remote.
$ dvc add /path --to-remote
ERROR: No remote given to `--to-remote`. |
After giving it a thought, I've realized that this can be worked around for
can be accepted with the meaning of I've made a prototype implementation of this in my last commit. However:
So it's a matter of considering if the slight increase in complexity and ad-hoc parsing is worth it for obtaining the desired UI semantics. EDIT:
So taking that into account, I'd probably lean towards something like what @jorgeorpinel suggested here:
|
Thanks for the idea @alopezz ! But I'm guessing the core team will prefer to avoid ad-hoc arg parsing (cc @skshetry ?) The problem with the Probably the choice boils down to: |
I mentioned these issues somewhere in the past, and that was one of the reasons (a small one compared to the consistency) that why we didn't implement it. The ambiguity can be solved via checking whether the remote exists and if so using, though that is a very complicated behavior to describe and might lead to unexpected consequences and I do not suggest implementing it at all. I personally think that the current approach makes sense since specifying a remote would be the minority case, so we can just add |
Thanks for the PR and great discussion!
|
Fixes #5719
β I have followed the Contributing to DVC checklist.
π If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here.
I removed
--remote
altogether; I'm not sure if this is the way to go or if there is any sort of deprecation policy in which case I'd restore it and make the appropriate changes.It looks to me like the execution path where a remote other than the default is used is not covered by the tests; if you think it'd be valuable, I can try to add a couple of test cases covering that.
I'll update the docs once I get some feedback.