mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
cli: config: check name format (#5090)
Currently we don't handle bad name well: ``` (dvc-3.8.3) ➜ dvc git:(config-bug) ✗ dvc config section ERROR: unexpected error - not enough values to unpack (expected 2, got 1) ``` With this PR, we check name to conform to either `remote.name.option` or `section.option`, so we'll give a more friendly: ``` (dvc-3.8.3) ➜ dvc git:(config-bug) ✗ dvc config section ERROR: argument name: name argument should look like remote.name.option or section.option usage: dvc config [-h] [--global | --system | --local] [-q | -v] [-u] [-l] [name] [value] Get or set config options. Documentation: <https://man.dvc.org/config> positional arguments: name Option name (remote.name.option or section.option). value Option value. optional arguments: -h, --help show this help message and exit --global Use global config. --system Use system config. --local Use local config. -q, --quiet Be quiet. -v, --verbose Be verbose. -u, --unset Unset option. -l, --list List all defined config values. ```
This commit is contained in:
@@ -141,14 +141,14 @@ class TestGCMultipleDvcRepos(TestDvc):
|
||||
|
||||
class TestConfig(TestDvc):
|
||||
def test(self):
|
||||
name = "param"
|
||||
name = "section.option"
|
||||
value = "1"
|
||||
|
||||
args = parse_args(["config", "-u", "--unset", name, value])
|
||||
|
||||
self.assertIsInstance(args.func(args), CmdConfig)
|
||||
self.assertEqual(args.unset, True)
|
||||
self.assertEqual(args.name, name)
|
||||
self.assertEqual(args.name, (False, "section", "option"))
|
||||
self.assertEqual(args.value, value)
|
||||
|
||||
def test_config_list(self):
|
||||
|
||||
Reference in New Issue
Block a user