From cea4dcda14e58127d6d64a6af904a23517c9e1f9 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Sun, 17 Sep 2017 23:35:56 -0700 Subject: [PATCH] Config cmd print error messages --- dvc/command/config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dvc/command/config.py b/dvc/command/config.py index 178c6b553..9c6ed3461 100644 --- a/dvc/command/config.py +++ b/dvc/command/config.py @@ -5,6 +5,7 @@ from dvc.command.base import CmdBase, DvcLock from dvc.logger import Logger from dvc.config import Config + class CmdConfig(CmdBase): def __init__(self, settings): super(CmdConfig, self).__init__(settings) @@ -55,15 +56,18 @@ class CmdConfig(CmdBase): return 0 def check_opt(self): - _section, _opt = self.parsed_args.name.strip().split('.') + _section, _opt = self.parsed_args.name.strip().split('.', 1) add = (self.parsed_args.value != None and self.parsed_args.unset == False) section = self._get_key(self.configobj, _section, add) + if not section: + Logger.error('Invalid option name {}'.format(_section)) return 1 opt = self._get_key(self.configobj[section], _opt, add) if not opt: + Logger.error('Invalid option value: {}'.format(_opt)) return 1 self.section = section