-
-
Notifications
You must be signed in to change notification settings - Fork 286
fix: add description for subcommands #1120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d6d0b42
fix(cli/commands): add description for subcommands
marcosdotme 6eb8704
refactor(tests/commands): move "other" tests for the correspondent file
marcosdotme 1da181c
refactor(KNOWN_SCHEMES): replace set comprehension for list comprehen…
marcosdotme bbf19ad
test(commands): add skip_if_below_py_3_10 as the message of argument …
Lee-W File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
...s/commands/test_bump_command/test_bump_command_shows_description_when_use_help_option.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
usage: cz bump [-h] [--dry-run] [--files-only] [--local-version] [--changelog] | ||
[--no-verify] [--yes] [--tag-format TAG_FORMAT] | ||
[--bump-message BUMP_MESSAGE] [--prerelease {alpha,beta,rc}] | ||
[--devrelease DEVRELEASE] [--increment {MAJOR,MINOR,PATCH}] | ||
[--increment-mode {linear,exact}] [--check-consistency] | ||
[--annotated-tag] | ||
[--annotated-tag-message ANNOTATED_TAG_MESSAGE] [--gpg-sign] | ||
[--changelog-to-stdout] [--git-output-to-stderr] [--retry] | ||
[--major-version-zero] [--template TEMPLATE] [--extra EXTRA] | ||
[--file-name FILE_NAME] [--prerelease-offset PRERELEASE_OFFSET] | ||
[--version-scheme {pep440,semver,semver2}] | ||
[--version-type {pep440,semver,semver2}] | ||
[--build-metadata BUILD_METADATA] | ||
[MANUAL_VERSION] | ||
|
||
bump semantic version based on the git log | ||
|
||
positional arguments: | ||
MANUAL_VERSION bump to the given version (e.g: 1.5.3) | ||
|
||
options: | ||
-h, --help show this help message and exit | ||
--dry-run show output to stdout, no commit, no modified files | ||
--files-only bump version in the files from the config | ||
--local-version bump only the local version portion | ||
--changelog, -ch generate the changelog for the newest version | ||
--no-verify this option bypasses the pre-commit and commit-msg | ||
hooks | ||
--yes accept automatically questions done | ||
--tag-format TAG_FORMAT | ||
the format used to tag the commit and read it, use it | ||
in existing projects, wrap around simple quotes | ||
--bump-message BUMP_MESSAGE | ||
template used to create the release commit, useful | ||
when working with CI | ||
--prerelease {alpha,beta,rc}, -pr {alpha,beta,rc} | ||
choose type of prerelease | ||
--devrelease DEVRELEASE, -d DEVRELEASE | ||
specify non-negative integer for dev. release | ||
--increment {MAJOR,MINOR,PATCH} | ||
manually specify the desired increment | ||
--increment-mode {linear,exact} | ||
set the method by which the new version is chosen. | ||
'linear' (default) guesses the next version based on | ||
typical linear version progression, such that bumping | ||
of a pre-release with lower precedence than the | ||
current pre-release phase maintains the current phase | ||
of higher precedence. 'exact' applies the changes that | ||
have been specified (or determined from the commit | ||
log) without interpretation, such that the increment | ||
and pre-release are always honored | ||
--check-consistency, -cc | ||
check consistency among versions defined in commitizen | ||
configuration and version_files | ||
--annotated-tag, -at create annotated tag instead of lightweight one | ||
--annotated-tag-message ANNOTATED_TAG_MESSAGE, -atm ANNOTATED_TAG_MESSAGE | ||
create annotated tag message | ||
--gpg-sign, -s sign tag instead of lightweight one | ||
--changelog-to-stdout | ||
Output changelog to the stdout | ||
--git-output-to-stderr | ||
Redirect git output to stderr | ||
--retry retry commit if it fails the 1st time | ||
--major-version-zero keep major version at zero, even for breaking changes | ||
--template TEMPLATE, -t TEMPLATE | ||
changelog template file name (relative to the current | ||
working directory) | ||
--extra EXTRA, -e EXTRA | ||
a changelog extra variable (in the form 'key=value') | ||
--file-name FILE_NAME | ||
file name of changelog (default: 'CHANGELOG.md') | ||
--prerelease-offset PRERELEASE_OFFSET | ||
start pre-releases with this offset | ||
--version-scheme {pep440,semver,semver2} | ||
choose version scheme | ||
--version-type {pep440,semver,semver2} | ||
Deprecated, use --version-scheme | ||
--build-metadata BUILD_METADATA | ||
Add additional build-metadata to the version-number |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
.../test_changelog_command/test_changelog_command_shows_description_when_use_help_option.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
usage: cz changelog [-h] [--dry-run] [--file-name FILE_NAME] | ||
[--unreleased-version UNRELEASED_VERSION] [--incremental] | ||
[--start-rev START_REV] [--merge-prerelease] | ||
[--version-scheme {pep440,semver,semver2}] | ||
[--export-template EXPORT_TEMPLATE] [--template TEMPLATE] | ||
[--extra EXTRA] | ||
[rev_range] | ||
|
||
generate changelog (note that it will overwrite existing file) | ||
|
||
positional arguments: | ||
rev_range generates changelog for the given version (e.g: 1.5.3) | ||
or version range (e.g: 1.5.3..1.7.9) | ||
|
||
options: | ||
-h, --help show this help message and exit | ||
--dry-run show changelog to stdout | ||
--file-name FILE_NAME | ||
file name of changelog (default: 'CHANGELOG.md') | ||
--unreleased-version UNRELEASED_VERSION | ||
set the value for the new version (use the tag value), | ||
instead of using unreleased | ||
--incremental generates changelog from last created version, useful | ||
if the changelog has been manually modified | ||
--start-rev START_REV | ||
start rev of the changelog. If not set, it will | ||
generate changelog from the start | ||
--merge-prerelease collect all changes from prereleases into next non- | ||
prerelease. If not set, it will include prereleases in | ||
the changelog | ||
--version-scheme {pep440,semver,semver2} | ||
choose version scheme | ||
--export-template EXPORT_TEMPLATE | ||
Export the changelog template into this file instead | ||
of rendering it | ||
--template TEMPLATE, -t TEMPLATE | ||
changelog template file name (relative to the current | ||
working directory) | ||
--extra EXTRA, -e EXTRA | ||
a changelog extra variable (in the form 'key=value') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...commands/test_check_command/test_check_command_shows_description_when_use_help_option.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
usage: cz check [-h] | ||
[--commit-msg-file COMMIT_MSG_FILE | --rev-range REV_RANGE | -m MESSAGE] | ||
[--allow-abort] [--allowed-prefixes [ALLOWED_PREFIXES ...]] | ||
|
||
validates that a commit message matches the commitizen schema | ||
|
||
options: | ||
-h, --help show this help message and exit | ||
--commit-msg-file COMMIT_MSG_FILE | ||
ask for the name of the temporal file that contains | ||
the commit message. Using it in a git hook script: | ||
MSG_FILE=$1 | ||
--rev-range REV_RANGE | ||
a range of git rev to check. e.g, master..HEAD | ||
-m MESSAGE, --message MESSAGE | ||
commit message that needs to be checked | ||
--allow-abort allow empty commit messages, which typically abort a | ||
commit | ||
--allowed-prefixes [ALLOWED_PREFIXES ...] | ||
allowed commit message prefixes. If the message starts | ||
by one of these prefixes, the message won't be checked | ||
against the regex |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...mmands/test_commit_command/test_commit_command_shows_description_when_use_help_option.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
usage: cz commit [-h] [--retry] [--no-retry] [--dry-run] | ||
[--write-message-to-file FILE_PATH] [-s] [-a] | ||
[-l MESSAGE_LENGTH_LIMIT] | ||
|
||
create new commit | ||
|
||
options: | ||
-h, --help show this help message and exit | ||
--retry retry last commit | ||
--no-retry skip retry if retry_after_failure is set to true | ||
--dry-run show output to stdout, no commit, no modified files | ||
--write-message-to-file FILE_PATH | ||
write message to file before committing (can be | ||
combined with --dry-run) | ||
-s, --signoff sign off the commit | ||
-a, --all Tell the command to automatically stage files that | ||
have been modified and deleted, but new files you have | ||
not told Git about are not affected. | ||
-l MESSAGE_LENGTH_LIMIT, --message-length-limit MESSAGE_LENGTH_LIMIT | ||
length limit of the commit message; 0 for no limit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import pytest | ||
import sys | ||
from commitizen import cli, commands | ||
|
||
from pytest_mock import MockerFixture | ||
|
||
from tests.utils import skip_below_py_3_10 | ||
|
||
|
||
def test_example(config, mocker: MockerFixture): | ||
write_mock = mocker.patch("commitizen.out.write") | ||
commands.Example(config)() | ||
write_mock.assert_called_once() | ||
|
||
|
||
@skip_below_py_3_10 | ||
def test_example_command_shows_description_when_use_help_option( | ||
mocker: MockerFixture, capsys, file_regression | ||
): | ||
testargs = ["cz", "example", "--help"] | ||
mocker.patch.object(sys, "argv", testargs) | ||
with pytest.raises(SystemExit): | ||
cli.main() | ||
|
||
out, _ = capsys.readouterr() | ||
file_regression.check(out, extension=".txt") |
6 changes: 6 additions & 0 deletions
6
...ands/test_example_command/test_example_command_shows_description_when_use_help_option.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
usage: cz example [-h] | ||
|
||
show commit example | ||
|
||
options: | ||
-h, --help show this help message and exit |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.