dvc: add dvc remote modify command

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2018-04-07 01:21:05 +03:00
parent 817695305e
commit 1ad63d1ba6
2 changed files with 30 additions and 1 deletions
+23 -1
View File
@@ -16,7 +16,7 @@ from dvc.command.gc import CmdGC
from dvc.command.add import CmdAdd
from dvc.command.config import CmdConfig
from dvc.command.checkout import CmdCheckout
from dvc.command.remote import CmdRemoteAdd, CmdRemoteRemove
from dvc.command.remote import CmdRemoteAdd, CmdRemoteRemove, CmdRemoteModify
from dvc.stage import Stage
from dvc import VERSION
@@ -275,6 +275,28 @@ def parse_args(argv=None):
remote_remove_parser.set_defaults(func=CmdRemoteRemove)
remote_modify_parser = remote_subparsers.add_parser(
'modify',
parents=[parent_parser],
help='Modify remote')
remote_modify_parser.add_argument(
'name',
help='Name')
remote_modify_parser.add_argument(
'option',
help='Option')
remote_modify_parser.add_argument(
'value',
nargs='?',
help='Value')
remote_modify_parser.add_argument('-u',
'--unset',
default=False,
action='store_true',
help='Unset option')
remote_modify_parser.set_defaults(func=CmdRemoteModify)
args = parser.parse_args(argv)
return args
+7
View File
@@ -13,3 +13,10 @@ class CmdRemoteRemove(CmdConfig):
def run(self):
section = Config.SECTION_REMOTE_FMT.format(self.args.name)
return self.unset(section, Config.SECTION_REMOTE_URL)
class CmdRemoteModify(CmdConfig):
def run(self):
section = Config.SECTION_REMOTE_FMT.format(self.args.name)
self.args.name = '{}.{}'.format(section, self.args.option)
return super(CmdRemoteModify, self).run()