diff --git a/dvc/command/diff.py b/dvc/command/diff.py index 12fde9264..ca316d116 100644 --- a/dvc/command/diff.py +++ b/dvc/command/diff.py @@ -86,7 +86,7 @@ class CmdDiff(CmdBase): if not any(diff.values()): return 0 - if self.args.json: + if self.args.show_json: res = json.dumps(diff) else: res = self._format(diff, include_checksums=self.args.checksums) @@ -136,7 +136,7 @@ def add_parser(subparsers, parent_parser): ), ) diff_parser.add_argument( - "--json", + "--show-json", help="Format the output into a JSON", action="store_true", default=False, diff --git a/scripts/completion/dvc.bash b/scripts/completion/dvc.bash index 128a64326..b64839029 100644 --- a/scripts/completion/dvc.bash +++ b/scripts/completion/dvc.bash @@ -22,7 +22,7 @@ _dvc_checkout='-d --with-deps -R --recursive -f --force --relink $(compgen -G *. _dvc_commit='-f --force -d --with-deps -R --recursive $(compgen -G *.dvc)' _dvc_config='-u --unset --local --system --global' _dvc_destroy='-f --force' -_dvc_diff='-t --target --json --checksums' +_dvc_diff='-t --target --show-json --checksums' _dvc_fetch='-j --jobs -r --remote -a --all-branches -T --all-tags -d --with-deps -R --recursive $(compgen -G *.dvc)' _dvc_get_url='' _dvc_get='-o --out --rev --show-url' diff --git a/scripts/completion/dvc.zsh b/scripts/completion/dvc.zsh index be47469d5..08ed4f607 100644 --- a/scripts/completion/dvc.zsh +++ b/scripts/completion/dvc.zsh @@ -98,7 +98,7 @@ _dvc_destroy=( _dvc_diff=( {-t,--target}"[Source path to a data file or directory.]:Target files:" - "--json[Format the output into a JSON]" + "--show-json[Format the output into a JSON]" "--checksums[Display checksums for each entry]" {1,2}":Git revision (e.g. branch, tag, SHA):" ) diff --git a/tests/unit/command/test_diff.py b/tests/unit/command/test_diff.py index 8454118f2..80ac06e4b 100644 --- a/tests/unit/command/test_diff.py +++ b/tests/unit/command/test_diff.py @@ -46,7 +46,7 @@ def test_checksums(mocker, caplog): def test_json(mocker, caplog): - args = parse_args(["diff", "--json"]) + args = parse_args(["diff", "--show-json"]) cmd = args.func(args) diff = { "added": [{"filename": "file", "checksum": "00000000"}],