From ceaba68f629ab97905bcf365667e6f289d0617b4 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Thu, 31 Dec 2020 00:54:52 +0200 Subject: [PATCH] config: temporarily forbid --show-origin without level (#5184) --- dvc/command/config.py | 6 ++++++ tests/func/test_config.py | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dvc/command/config.py b/dvc/command/config.py index d684f3527..b2c121821 100644 --- a/dvc/command/config.py +++ b/dvc/command/config.py @@ -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)): diff --git a/tests/func/test_config.py b/tests/func/test_config.py index 57e8d2b13..b1f581027 100644 --- a/tests/func/test_config.py +++ b/tests/func/test_config.py @@ -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"),