-
Notifications
You must be signed in to change notification settings - Fork 1.3k
cli: add --cd flag to change directories before executing commands #4566
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
Conversation
dvc/command/repro.py
Outdated
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 is always initialized with os.curdir if not given a value. Alternative would be if self.args.cwd != os.curdir
pared
left a comment
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.
@bobertlo Looks good to me, lets please wait for some more reviews, as it impact all commands.
pmrowla
left a comment
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.
Functionality-wise this LGTM, but it looks a bit strange for us to have different naming conventions for dvc -C/--cd and dvc repro -c/--cwd. Seems to me that we should be using the same set of short/long flags for both of those options.
|
@pmrowla the idea is not breaking existing functionality. With arparse, having I've seen at least one other issue where replacing argparse would be beneficial but otherwise this is the best I could think of so far? I think the audience using I could implement other solutions but it would either be whole thing or break compatibility. |
|
w/argparse you can get around the naming conflict by specifying the I'm not sure how many DVC users actually use (or are even aware of) |
|
@pmrowla thanks for the great info on argparse. When I started working on this I saw #4116 and assumed the The PR as is should not break any current functionality but I would be happy to make changes if a consensus is reached. |
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.
Sorry for the delay.
This looks great! Just 2 minor comments:
-
How about we only keep
--cdand don't use-Cfor now? It seems like this option is for a pretty specific advanced usage, so taking up a nice short-Coption feels a bit wasteful. We could always consider bringing it back in the future. -
Great point about
repro -c! Let's mark it as obsolete in dvc and docs right now and we'll drop it in 2.0
|
Ok. I will get on this ASAP.
|
|
Okay, I have simply removed the |
|
@efiop okay, I have also added a little note to the help message for This should be ready for review now. |
efiop
left a comment
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.
Thanks!
Fixes #4025
I was initally going to use
--cwdand remove--cwdfromrepro, but that leftreprowith the very strangeargs.cvalue. So I turned to the tar manpage for inspiratoin and found the long form of-Cis--cd. Tar is good enough for me.I actually ran into this problem yesterday trying to launch dvc from ssh for a dumb reason.
I also added a docs PR:
treeverse/dvc.org#1780
❗ 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.
Thank you for the contribution - we'll try to review it as soon as possible. 🙏