config: temporarily forbid --show-origin without level (#5184)

This commit is contained in:
Ruslan Kuprieiev
2020-12-31 00:54:52 +02:00
committed by GitHub
parent 8162bb159c
commit ceaba68f62
2 changed files with 10 additions and 2 deletions
+6
View File
@@ -43,6 +43,12 @@ class CmdConfig(CmdBaseNoRepo):
"options: -u/--unset, value"
)
return 1
if not self.args.level:
logger.error(
"--show-origin requires one of these options: "
"--system, --global, --repo, --local"
)
return 1
if self.args.list:
if any((self.args.name, self.args.value, self.args.unset)):
+4 -2
View File
@@ -261,14 +261,16 @@ def test_config_show_origin(tmp_dir, dvc, caplog):
)
caplog.clear()
assert main(["config", "--show-origin", "remote.myremote.url"]) == 0
assert (
main(["config", "--show-origin", "--repo", "remote.myremote.url"]) == 0
)
assert (
"{}\t{}\n".format(os.path.join(".dvc", "config"), "s3://bucket/path")
in caplog.text
)
caplog.clear()
assert main(["config", "--list", "--show-origin"]) == 0
assert main(["config", "--list", "--repo", "--show-origin"]) == 0
assert (
"{}\t{}\n".format(
os.path.join(".dvc", "config"),