Skip to content

commitizen does not warn "Command is required" when providing non-exists command on Python 3.9 #429

Closed
@Lee-W

Description

@Lee-W

Description

the root cause of this issue is that argparse raises a different exception on Python 3.9. this also break our test cases

Steps to reproduce

  1. git clone this project
  2. poetry env use 3.9
  3. poetry run cz c nocommand

Current behavior

$ poetry run cz nocommand
usage: cz [-h] [--debug] [-n NAME] {init,commit,c,ls,example,info,schema,bump,changelog,ch,check,version} ...
cz: error: argument {init,commit,c,ls,example,info,schema,bump,changelog,ch,check,version}: invalid choice: 'nocommand' (choose from 'init', 'commit', 'c', 'ls', 'example', 'info', 'schema', 'bump', 'changelog', 'ch', 'check', 'version')

Desired behavior

warn "Command is required" at the end

poetry run cz nocommand
usage: cz [-h] [--debug] [-n NAME] {init,commit,c,ls,example,info,schema,bump,changelog,ch,check,version} ...
cz: error: argument {init,commit,c,ls,example,info,schema,bump,changelog,ch,check,version}: invalid choice: 'nocommand' (choose from 'init', 'commit', 'c', 'ls', 'example', 'info', 'schema', 'bump', 'changelog', 'ch', 'check', 'version')
Command is required

Environment

  • commitizen version: 2.18.1
  • python version: Python 3.9.7
  • operating system: Darwin

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions