mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-26 07:18:31 +01:00
dvc: add dvc remote modify command
Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
+23
-1
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user