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"),