Skip to content

Commit b4508a9

Browse files
committed
refactor(cli): remove "--version" argument
BREAKING CHANGE: Use "cz verion" instead
1 parent 0317eae commit b4508a9

File tree

2 files changed

+0
-31
lines changed

2 files changed

+0
-31
lines changed

commitizen/cli.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import argparse
22
import logging
33
import sys
4-
import warnings
54
from functools import partial
65

76
from decli import cli
@@ -24,11 +23,6 @@
2423
"name": ["-n", "--name"],
2524
"help": "use the given commitizen (default: cz_conventional_commits)",
2625
},
27-
{
28-
"name": ["--version"],
29-
"action": "store_true",
30-
"help": "get the version of the installed commitizen",
31-
},
3226
],
3327
"subcommands": {
3428
"title": "commands",
@@ -277,16 +271,6 @@ def main():
277271
elif not args.name and not conf.path:
278272
conf.update({"name": "cz_conventional_commits"})
279273

280-
if args.version:
281-
warnings.warn(
282-
(
283-
"'cz --version' will be deprecated in next major version. "
284-
"Please use 'cz version' command from your scripts"
285-
),
286-
category=DeprecationWarning,
287-
)
288-
args.func = commands.Version
289-
290274
if args.debug:
291275
logging.getLogger("commitizen").setLevel(logging.DEBUG)
292276
sys.excepthook = commitizen_debug_excepthook

tests/test_cli.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,6 @@ def test_ls(mocker, capsys):
5555
assert isinstance(out, str)
5656

5757

58-
def test_arg_version(mocker, capsys):
59-
testargs = ["cz", "--version"]
60-
mocker.patch.object(sys, "argv", testargs)
61-
62-
with pytest.warns(DeprecationWarning) as record:
63-
cli.main()
64-
out, _ = capsys.readouterr()
65-
assert out.strip() == __version__
66-
67-
assert record[0].message.args[0] == (
68-
"'cz --version' will be deprecated in next major version. "
69-
"Please use 'cz version' command from your scripts"
70-
)
71-
72-
7358
def test_arg_debug(mocker):
7459
testargs = ["cz", "--debug", "info"]
7560
mocker.patch.object(sys, "argv", testargs)

0 commit comments

Comments
 (0)