diff --git a/docs/config/configuration_file.md b/docs/config/configuration_file.md index c38b8b4c8..172cbce1a 100644 --- a/docs/config/configuration_file.md +++ b/docs/config/configuration_file.md @@ -48,182 +48,182 @@ All formats support the same configuration options. Choose the format that best ## Configuration Structure -### TOML Format - -For TOML files, Commitizen settings are placed under the `[tool.commitizen]` section. If you're using a standalone `.cz.toml` or `cz.toml` file, you can use `[tool.commitizen]` or just `[commitizen]`. - -**Example: `pyproject.toml`, `.cz.toml` or `cz.toml`** - -```toml title="pyproject.toml" -[tool.commitizen] -name = "cz_conventional_commits" -version = "0.1.0" -version_provider = "commitizen" -version_scheme = "pep440" -version_files = [ - "src/__version__.py", - "pyproject.toml:version" -] -tag_format = "$version" -update_changelog_on_bump = true -changelog_file = "CHANGELOG.md" -changelog_incremental = false -bump_message = "bump: version $current_version → $new_version" -gpg_sign = false -annotated_tag = false -major_version_zero = false -prerelease_offset = 0 -retry_after_failure = false -allow_abort = false -message_length_limit = 0 -allowed_prefixes = [ - "Merge", - "Revert", - "Pull request", - "fixup!", - "squash!", - "amend!" -] -breaking_change_exclamation_in_title = false -use_shortcuts = false -pre_bump_hooks = [] -post_bump_hooks = [] -encoding = "utf-8" - -# Optional: Custom styling for prompts -style = [ - ["qmark", "fg:#ff9d00 bold"], - ["question", "bold"], - ["answer", "fg:#ff9d00 bold"], - ["pointer", "fg:#ff9d00 bold"], - ["highlighted", "fg:#ff9d00 bold"], - ["selected", "fg:#cc5454"], - ["separator", "fg:#cc5454"], - ["instruction", ""], - ["text", ""], - ["disabled", "fg:#858585 italic"] -] -``` - -### JSON Format - -For JSON files, Commitizen settings are placed under the `commitizen` key. - -**Example: `.cz.json` or `cz.json`** - -```json title=".cz.json" -{ - "commitizen": { - "name": "cz_conventional_commits", - "version": "0.1.0", - "version_provider": "commitizen", - "version_scheme": "pep440", - "version_files": [ - "src/__version__.py", - "pyproject.toml:version" - ], - "tag_format": "$version", - "update_changelog_on_bump": true, - "changelog_file": "CHANGELOG.md", - "changelog_incremental": false, - "bump_message": "bump: version $current_version → $new_version", - "gpg_sign": false, - "annotated_tag": false, - "major_version_zero": false, - "prerelease_offset": 0, - "retry_after_failure": false, - "allow_abort": false, - "message_length_limit": 0, - "allowed_prefixes": [ - "Merge", - "Revert", - "Pull request", - "fixup!", - "squash!", - "amend!" - ], - "breaking_change_exclamation_in_title": false, - "use_shortcuts": false, - "pre_bump_hooks": [], - "post_bump_hooks": [], - "encoding": "utf-8", - "style": [ - ["qmark", "fg:#ff9d00 bold"], - ["question", "bold"], - ["answer", "fg:#ff9d00 bold"], - ["pointer", "fg:#ff9d00 bold"], - ["highlighted", "fg:#ff9d00 bold"], - ["selected", "fg:#cc5454"], - ["separator", "fg:#cc5454"], - ["instruction", ""], - ["text", ""], - ["disabled", "fg:#858585 italic"] +=== "TOML Format" + + For TOML files, Commitizen settings are placed under the `[tool.commitizen]` section. If you're using a standalone `.cz.toml` or `cz.toml` file, you can use `[tool.commitizen]` or just `[commitizen]`. + + **Example: `pyproject.toml`, `.cz.toml` or `cz.toml`** + + ```toml title="pyproject.toml" + [tool.commitizen] + name = "cz_conventional_commits" + version = "0.1.0" + version_provider = "commitizen" + version_scheme = "pep440" + version_files = [ + "src/__version__.py", + "pyproject.toml:version" + ] + tag_format = "$version" + update_changelog_on_bump = true + changelog_file = "CHANGELOG.md" + changelog_incremental = false + bump_message = "bump: version $current_version → $new_version" + gpg_sign = false + annotated_tag = false + major_version_zero = false + prerelease_offset = 0 + retry_after_failure = false + allow_abort = false + message_length_limit = 0 + allowed_prefixes = [ + "Merge", + "Revert", + "Pull request", + "fixup!", + "squash!", + "amend!" + ] + breaking_change_exclamation_in_title = false + use_shortcuts = false + pre_bump_hooks = [] + post_bump_hooks = [] + encoding = "utf-8" + + # Optional: Custom styling for prompts + style = [ + ["qmark", "fg:#ff9d00 bold"], + ["question", "bold"], + ["answer", "fg:#ff9d00 bold"], + ["pointer", "fg:#ff9d00 bold"], + ["highlighted", "fg:#ff9d00 bold"], + ["selected", "fg:#cc5454"], + ["separator", "fg:#cc5454"], + ["instruction", ""], + ["text", ""], + ["disabled", "fg:#858585 italic"] ] - } -} -``` - -### YAML Format - -For YAML files, Commitizen settings are placed under the `commitizen` key. - -**Example: `.cz.yaml` or `cz.yaml`** - -```yaml title=".cz.yaml" -commitizen: - name: cz_conventional_commits - version: "0.1.0" - version_provider: commitizen - version_scheme: pep440 - version_files: - - src/__version__.py - - pyproject.toml:version - tag_format: "$version" - update_changelog_on_bump: true - changelog_file: CHANGELOG.md - changelog_incremental: false - bump_message: "bump: version $current_version → $new_version" - gpg_sign: false - annotated_tag: false - major_version_zero: false - prerelease_offset: 0 - retry_after_failure: false - allow_abort: false - message_length_limit: 0 - allowed_prefixes: - - Merge - - Revert - - Pull request - - fixup! - - squash! - - amend! - breaking_change_exclamation_in_title: false - use_shortcuts: false - pre_bump_hooks: [] - post_bump_hooks: [] - encoding: utf-8 - style: - - - qmark - - fg:#ff9d00 bold - - - question - - bold - - - answer - - fg:#ff9d00 bold - - - pointer - - fg:#ff9d00 bold - - - highlighted - - fg:#ff9d00 bold - - - selected - - fg:#cc5454 - - - separator - - fg:#cc5454 - - - instruction - - "" - - - text - - "" - - - disabled - - fg:#858585 italic -``` + ``` + +=== "JSON Format" + + For JSON files, Commitizen settings are placed under the `commitizen` key. + + **Example: `.cz.json` or `cz.json`** + + ```json title=".cz.json" + { + "commitizen": { + "name": "cz_conventional_commits", + "version": "0.1.0", + "version_provider": "commitizen", + "version_scheme": "pep440", + "version_files": [ + "src/__version__.py", + "pyproject.toml:version" + ], + "tag_format": "$version", + "update_changelog_on_bump": true, + "changelog_file": "CHANGELOG.md", + "changelog_incremental": false, + "bump_message": "bump: version $current_version → $new_version", + "gpg_sign": false, + "annotated_tag": false, + "major_version_zero": false, + "prerelease_offset": 0, + "retry_after_failure": false, + "allow_abort": false, + "message_length_limit": 0, + "allowed_prefixes": [ + "Merge", + "Revert", + "Pull request", + "fixup!", + "squash!", + "amend!" + ], + "breaking_change_exclamation_in_title": false, + "use_shortcuts": false, + "pre_bump_hooks": [], + "post_bump_hooks": [], + "encoding": "utf-8", + "style": [ + ["qmark", "fg:#ff9d00 bold"], + ["question", "bold"], + ["answer", "fg:#ff9d00 bold"], + ["pointer", "fg:#ff9d00 bold"], + ["highlighted", "fg:#ff9d00 bold"], + ["selected", "fg:#cc5454"], + ["separator", "fg:#cc5454"], + ["instruction", ""], + ["text", ""], + ["disabled", "fg:#858585 italic"] + ] + } + } + ``` + +=== "YAML Format" + + For YAML files, Commitizen settings are placed under the `commitizen` key. + + **Example: `.cz.yaml` or `cz.yaml`** + + ```yaml title=".cz.yaml" + commitizen: + name: cz_conventional_commits + version: "0.1.0" + version_provider: commitizen + version_scheme: pep440 + version_files: + - src/__version__.py + - pyproject.toml:version + tag_format: "$version" + update_changelog_on_bump: true + changelog_file: CHANGELOG.md + changelog_incremental: false + bump_message: "bump: version $current_version → $new_version" + gpg_sign: false + annotated_tag: false + major_version_zero: false + prerelease_offset: 0 + retry_after_failure: false + allow_abort: false + message_length_limit: 0 + allowed_prefixes: + - Merge + - Revert + - Pull request + - fixup! + - squash! + - amend! + breaking_change_exclamation_in_title: false + use_shortcuts: false + pre_bump_hooks: [] + post_bump_hooks: [] + encoding: utf-8 + style: + - - qmark + - fg:#ff9d00 bold + - - question + - bold + - - answer + - fg:#ff9d00 bold + - - pointer + - fg:#ff9d00 bold + - - highlighted + - fg:#ff9d00 bold + - - selected + - fg:#cc5454 + - - separator + - fg:#cc5454 + - - instruction + - "" + - - text + - "" + - - disabled + - fg:#858585 italic + ``` ## Configuration Options @@ -244,4 +244,4 @@ Key configuration categories include: For advanced customization, including creating custom commit rules, see the [Customization](../customization/config_file.md) documentation. !!! note - The `customize` option is only supported when using TOML configuration files. + The `customize` option is supported in TOML, JSON, and YAML configuration files. For Python projects, adding it to `pyproject.toml` keeps all project configuration in one place. diff --git a/docs/config/option.md b/docs/config/option.md index 5b7ce807b..4109f3ff7 100644 --- a/docs/config/option.md +++ b/docs/config/option.md @@ -26,7 +26,7 @@ Style for the prompts (It will merge this value with default style.) See [Stylin - Type: `dict` - Default: `None` -**This is only supported when config through `toml` configuration file.** +**Supported in TOML, JSON, and YAML configuration files.** Custom rules for committing and bumping. See [customization](../customization/config_file.md) for more details. @@ -35,4 +35,18 @@ Custom rules for committing and bumping. See [customization](../customization/co - Type: `bool` - Default: `False` -Show keyboard shortcuts when selecting from a list. Define a `key` for each of your choices to set the key. See [shortcut keys](../customization/config_file.md#shortcut-keys) for more details. +Show keyboard shortcuts when selecting from a list. When enabled, each choice shows a shortcut key; press that key or use the arrow keys to select. + +Example: + +```toml title="pyproject.toml" +[tool.commitizen] +name = "cz_conventional_commits" +use_shortcuts = true +``` + +Run `cz commit` to see shortcut keys on each choice. + +![Menu with shortcut keys](../images/cli_interactive/shortcut_default.gif) + +To customize which key is used for each choice (via the `key` field when using `cz_customize`), see [shortcut keys customization](../customization/config_file.md#shortcut-keys). diff --git a/docs/customization/config_file.md b/docs/customization/config_file.md index a391ef533..50185a758 100644 --- a/docs/customization/config_file.md +++ b/docs/customization/config_file.md @@ -8,142 +8,146 @@ The basic steps are: `cz_customize` is likely to be removed or renamed in the next major release. This change is still under discussion; you can continue using `cz_customize` for now and follow [#1385](https://github.com/commitizen-tools/commitizen/issues/1385) for the rationale, options, and current status. -Example: - -```toml title="pyproject.toml" -[tool.commitizen] -name = "cz_customize" - -[tool.commitizen.customize] -message_template = "{{change_type}}:{% if show_message %} {{message}}{% endif %}" -example = "feature: this feature enable customize through config file" -schema = ": " -schema_pattern = "(feature|bug fix):(\\s.*)" -bump_pattern = "^(break|new|fix|hotfix)" -bump_map = {"break" = "MAJOR", "new" = "MINOR", "fix" = "PATCH", "hotfix" = "PATCH"} -change_type_order = ["BREAKING CHANGE", "feat", "fix", "refactor", "perf"] -info_path = "cz_customize_info.txt" -info = """ -This is customized info -""" -commit_parser = "^(?Pfeature|bug fix):\\s(?P.*)?" -changelog_pattern = "^(feature|bug fix)?(!)?" -change_type_map = {"feature" = "Feat", "bug fix" = "Fix"} - -[[tool.commitizen.customize.questions]] -type = "list" -name = "change_type" -choices = [{value = "feature", name = "feature: A new feature."}, {value = "bug fix", name = "bug fix: A bug fix."}] -# choices = ["feature", "fix"] # short version -message = "Select the type of change you are committing" +The following shows the **same configuration** in TOML, JSON, and YAML; use the format your project uses. -[[tool.commitizen.customize.questions]] -type = "input" -name = "message" -message = "Body." - -[[tool.commitizen.customize.questions]] -type = "confirm" -name = "show_message" -message = "Do you want to add body message in commit?" -``` +Example: -The equivalent example for a json config file: - -```json title=".cz.json" -{ - "commitizen": { - "name": "cz_customize", - "customize": { - "message_template": "{{change_type}}:{% if show_message %} {{message}}{% endif %}", - "example": "feature: this feature enable customize through config file", - "schema": ": ", - "schema_pattern": "(feature|bug fix):(\\s.*)", - "bump_pattern": "^(break|new|fix|hotfix)", - "bump_map": { - "break": "MAJOR", - "new": "MINOR", - "fix": "PATCH", - "hotfix": "PATCH" - }, - "change_type_order": ["BREAKING CHANGE", "feat", "fix", "refactor", "perf"], - "info_path": "cz_customize_info.txt", - "info": "This is customized info", - "commit_parser": "^(?Pfeature|bug fix):\\s(?P.*)?", - "changelog_pattern": "^(feature|bug fix)?(!)?", - "change_type_map": {"feature": "Feat", "bug fix": "Fix"}, - "questions": [ - { - "type": "list", - "name": "change_type", - "choices": [ - { - "value": "feature", - "name": "feature: A new feature." - }, - { - "value": "bug fix", - "name": "bug fix: A bug fix." - } - ], - "message": "Select the type of change you are committing" - }, - { - "type": "input", - "name": "message", - "message": "Body." +=== "TOML" + + ```toml title="pyproject.toml" + [tool.commitizen] + name = "cz_customize" + + [tool.commitizen.customize] + message_template = "{{change_type}}:{% if show_message %} {{message}}{% endif %}" + example = "feature: this feature enable customize through config file" + schema = ": " + schema_pattern = "(feature|bug fix):(\\s.*)" + bump_pattern = "^(break|new|fix|hotfix)" + bump_map = {"break" = "MAJOR", "new" = "MINOR", "fix" = "PATCH", "hotfix" = "PATCH"} + change_type_order = ["BREAKING CHANGE", "feat", "fix", "refactor", "perf"] + info_path = "cz_customize_info.txt" + info = """ + This is customized info + """ + commit_parser = "^(?Pfeature|bug fix):\\s(?P.*)?" + changelog_pattern = "^(feature|bug fix)?(!)?" + change_type_map = {"feature" = "Feat", "bug fix" = "Fix"} + + [[tool.commitizen.customize.questions]] + type = "list" + name = "change_type" + choices = [{value = "feature", name = "feature: A new feature."}, {value = "bug fix", name = "bug fix: A bug fix."}] + # choices = ["feature", "fix"] # short version + message = "Select the type of change you are committing" + + [[tool.commitizen.customize.questions]] + type = "input" + name = "message" + message = "Body." + + [[tool.commitizen.customize.questions]] + type = "confirm" + name = "show_message" + message = "Do you want to add body message in commit?" + ``` + +=== "JSON" + + ```json title=".cz.json" + { + "commitizen": { + "name": "cz_customize", + "customize": { + "message_template": "{{change_type}}:{% if show_message %} {{message}}{% endif %}", + "example": "feature: this feature enable customize through config file", + "schema": ": ", + "schema_pattern": "(feature|bug fix):(\\s.*)", + "bump_pattern": "^(break|new|fix|hotfix)", + "bump_map": { + "break": "MAJOR", + "new": "MINOR", + "fix": "PATCH", + "hotfix": "PATCH" }, - { - "type": "confirm", - "name": "show_message", - "message": "Do you want to add body message in commit?" - } - ] + "change_type_order": ["BREAKING CHANGE", "feat", "fix", "refactor", "perf"], + "info_path": "cz_customize_info.txt", + "info": "This is customized info", + "commit_parser": "^(?Pfeature|bug fix):\\s(?P.*)?", + "changelog_pattern": "^(feature|bug fix)?(!)?", + "change_type_map": {"feature": "Feat", "bug fix": "Fix"}, + "questions": [ + { + "type": "list", + "name": "change_type", + "choices": [ + { + "value": "feature", + "name": "feature: A new feature." + }, + { + "value": "bug fix", + "name": "bug fix: A bug fix." + } + ], + "message": "Select the type of change you are committing" + }, + { + "type": "input", + "name": "message", + "message": "Body." + }, + { + "type": "confirm", + "name": "show_message", + "message": "Do you want to add body message in commit?" + } + ] + } } } -} -``` - -And the correspondent example for a yaml file: - -```yaml title=".cz.yaml" -commitizen: - name: cz_customize - customize: - message_template: '{{change_type}}:{% if show_message %} {{message}}{% endif %}' - example: 'feature: this feature enable customize through config file' - schema: ': ' - schema_pattern: '(feature|bug fix):(\\s.*)' - bump_pattern: '^(break|new|fix|hotfix)' - commit_parser: '^(?Pfeature|bug fix):\\s(?P.*)?' - changelog_pattern: '^(feature|bug fix)?(!)?' - change_type_map: - feature: Feat - bug fix: Fix - bump_map: - break: MAJOR - new: MINOR - fix: PATCH - hotfix: PATCH - change_type_order: ['BREAKING CHANGE', 'feat', 'fix', 'refactor', 'perf'] - info_path: cz_customize_info.txt - info: This is customized info - questions: - - type: list - name: change_type - choices: - - value: feature - name: 'feature: A new feature.' - - value: bug fix - name: 'bug fix: A bug fix.' - message: Select the type of change you are committing - - type: input - name: message - message: 'Body.' - - type: confirm - name: show_message - message: 'Do you want to add body message in commit?' -``` + ``` + +=== "YAML" + + ```yaml title=".cz.yaml" + commitizen: + name: cz_customize + customize: + message_template: '{{change_type}}:{% if show_message %} {{message}}{% endif %}' + example: 'feature: this feature enable customize through config file' + schema: ': ' + schema_pattern: '(feature|bug fix):(\\s.*)' + bump_pattern: '^(break|new|fix|hotfix)' + commit_parser: '^(?Pfeature|bug fix):\\s(?P.*)?' + changelog_pattern: '^(feature|bug fix)?(!)?' + change_type_map: + feature: Feat + bug fix: Fix + bump_map: + break: MAJOR + new: MINOR + fix: PATCH + hotfix: PATCH + change_type_order: ['BREAKING CHANGE', 'feat', 'fix', 'refactor', 'perf'] + info_path: cz_customize_info.txt + info: This is customized info + questions: + - type: list + name: change_type + choices: + - value: feature + name: 'feature: A new feature.' + - value: bug fix + name: 'bug fix: A bug fix.' + message: Select the type of change you are committing + - type: input + name: message + message: 'Body.' + - type: confirm + name: show_message + message: 'Do you want to add body message in commit?' + ``` ## Configuration File Options @@ -184,7 +188,47 @@ commitizen: ### Shortcut keys -When the `use_shortcuts` config option is enabled, Commitizen can show and use keyboard shortcuts to select items from lists directly. -For example, when using the `cz_conventional_commits` Commitizen template, shortcut keys are shown when selecting the commit type. -Unless otherwise defined, keyboard shortcuts will be numbered automatically. -To specify keyboard shortcuts for your custom choices, provide the shortcut using the `key` parameter in dictionary form for each choice you would like to customize. +For a basic overview of `use_shortcuts` and how the default menu looks, see the [`use_shortcuts` option](../config/option.md#use_shortcuts). + +#### `use_shortcuts` with `cz_customize` + +When using `cz_customize`, enabling `use_shortcuts` lets you set an optional `key` for each list/select choice so that choice shows your chosen shortcut. Rules below. + +Example: + +```toml title="pyproject.toml" +[tool.commitizen] +name = "cz_customize" +use_shortcuts = true + +[tool.commitizen.customize] +message_template = "{{prefix}}: {{message}}" +schema = ": " +schema_pattern = "(feat|fix|docs|test):(\\s.*)" + +[[tool.commitizen.customize.questions]] +type = "list" +name = "prefix" +message = "Select the type of change you are committing" +choices = [ + { value = "feat", name = "feat: A new feature.", key = "f" }, + { value = "fix", name = "fix: A bug fix.", key = "x" }, + { value = "docs", name = "docs: Documentation only changes", key = "d" }, + { value = "test", name = "test: Adding or correcting tests", key = "t" } +] + +[[tool.commitizen.customize.questions]] +type = "input" +name = "message" +message = "Commit body: " +``` + +![Menu with custom shortcut keys settings](../images/cli_interactive/shortcut_custom.gif) + +**Rules for `key`** + +| Rule | Description | +|------|-------------| +| Allowed | Lowercase `a`–`z` or digits `0`–`9` only | +| Uniqueness | Each `key` must be unique among all choices | +| Optional | Omit `key` to use default numeric order (1, 2, 3, …) | diff --git a/docs/images/cli_interactive/shortcut_custom.gif b/docs/images/cli_interactive/shortcut_custom.gif new file mode 100644 index 000000000..3096117d4 Binary files /dev/null and b/docs/images/cli_interactive/shortcut_custom.gif differ diff --git a/docs/images/cli_interactive/shortcut_default.gif b/docs/images/cli_interactive/shortcut_default.gif new file mode 100644 index 000000000..fc17469a5 Binary files /dev/null and b/docs/images/cli_interactive/shortcut_default.gif differ diff --git a/docs/images/shortcut_custom.tape b/docs/images/shortcut_custom.tape new file mode 100644 index 000000000..39f1c5838 --- /dev/null +++ b/docs/images/shortcut_custom.tape @@ -0,0 +1,159 @@ +Output cli_interactive/shortcut_custom.gif + +Require cz + +# Use bash for cross-platform compatibility (macOS, Linux, Windows) +Set Shell bash + +Set FontSize 16 +Set Width 878 +Set Height 568 +Set Padding 20 +Set TypingSpeed 50ms + +Set Theme { + "name": "Commitizen", + "black": "#232628", + "red": "#fc4384", + "green": "#b3e33b", + "yellow": "#ffa727", + "blue": "#75dff2", + "magenta": "#ae89fe", + "cyan": "#708387", + "white": "#d5d5d0", + "brightBlack": "#626566", + "brightRed": "#ff7fac", + "brightGreen": "#c8ed71", + "brightYellow": "#ebdf86", + "brightBlue": "#75dff2", + "brightMagenta": "#ae89fe", + "brightCyan": "#b1c6ca", + "brightWhite": "#f9f9f4", + "background": "#1e1e2e", + "foreground": "#afafaf", + "cursor": "#c7c7c7" +} + +# Hide initial shell prompt +Hide + +# Wait for terminal to be ready +Sleep 1s + +# Set a clean, simple prompt (while hidden) +Type "PS1='$ '" +Enter +Sleep 300ms + +# Create a clean temporary directory for recording +Type "rm -rf /tmp/commitizen-example && mkdir -p /tmp/commitizen-example && cd /tmp/commitizen-example" +Enter +Sleep 500ms + +# Initialize git repository +Type "git init" +Enter +Type "git config user.email 'you@example.com'" +Enter +Type "git config user.name 'Your Name'" +Enter +Sleep 500ms + +Type "git checkout -b awesome-docs" +Enter +Sleep 500ms + +Type `cat > pyproject.toml << 'EOF'` +Enter +Type `[tool.commitizen]` +Enter +Type `name = "cz_customize"` +Enter +Type `use_shortcuts = true` +Enter +Type `` +Enter +Type `[tool.commitizen.customize]` +Enter +Type `message_template = "{{prefix}}: {{message}}"` +Enter +Type `schema = ": "` +Enter +Type `schema_pattern = "(feat|fix|docs|test):(\\s.*)"` +Enter +Type `` +Enter +Type `[[tool.commitizen.customize.questions]]` +Enter +Type `type = "list"` +Enter +Type `name = "prefix"` +Enter +Type `message = "Select the type of change you are committing"` +Enter +Type `choices = [` +Enter +Type ` { value = "feat", name = "feat: A new feature.", key = "f" },` +Enter +Type ` { value = "fix", name = "fix: A bug fix.", key = "x" },` +Enter +Type ` { value = "docs", name = "docs: Documentation only changes", key = "d" },` +Enter +Type ` { value = "test", name = "test: Adding or correcting tests", key = "t" },` +Enter +Type `]` +Enter +Type `` +Enter +Type `[[tool.commitizen.customize.questions]]` +Enter +Type `type = "input"` +Enter +Type `name = "message"` +Enter +Type `message = "Commit body: "` +Enter +Type "EOF" +Enter +Sleep 300ms + +# Create a dummy file to commit +Type "echo 'test content' > README.md" +Enter +Sleep 300ms + +Type "git add README.md" +Enter +Sleep 300ms + +# Clear the screen to start fresh +Type "clear" +Enter +Sleep 500ms + +# Show commands from here +Show + +# Now run cz commit +Type "cz commit" +Sleep 500ms +Enter + +# Wait for first prompt to appear +Sleep 2s + +# Question 1: Select the type of change (press d to "docs") +Sleep 1s +Type "d" +Sleep 2s +Enter +Sleep 1s + +# Question 2: Commit body +Type "demo with custom keys" +Sleep 500ms +Enter +Sleep 500ms + +# Wait for commit success message +Sleep 1s diff --git a/docs/images/shortcut_default.tape b/docs/images/shortcut_default.tape new file mode 100644 index 000000000..204a18a47 --- /dev/null +++ b/docs/images/shortcut_default.tape @@ -0,0 +1,138 @@ +Output cli_interactive/shortcut_default.gif + +Require cz + +# Use bash for cross-platform compatibility (macOS, Linux, Windows) +Set Shell bash + +Set FontSize 16 +Set Width 878 +Set Height 568 +Set Padding 20 +Set TypingSpeed 50ms + +Set Theme { + "name": "Commitizen", + "black": "#232628", + "red": "#fc4384", + "green": "#b3e33b", + "yellow": "#ffa727", + "blue": "#75dff2", + "magenta": "#ae89fe", + "cyan": "#708387", + "white": "#d5d5d0", + "brightBlack": "#626566", + "brightRed": "#ff7fac", + "brightGreen": "#c8ed71", + "brightYellow": "#ebdf86", + "brightBlue": "#75dff2", + "brightMagenta": "#ae89fe", + "brightCyan": "#b1c6ca", + "brightWhite": "#f9f9f4", + "background": "#1e1e2e", + "foreground": "#afafaf", + "cursor": "#c7c7c7" +} + +# Hide initial shell prompt +Hide + +# Wait for terminal to be ready +Sleep 1s + +# Set a clean, simple prompt (while hidden) +Type "PS1='$ '" +Enter +Sleep 300ms + +# Create a clean temporary directory for recording +Type "rm -rf /tmp/commitizen-example && mkdir -p /tmp/commitizen-example && cd /tmp/commitizen-example" +Enter +Sleep 500ms + +# Initialize git repository +Type "git init" +Enter +Type "git config user.email 'you@example.com'" +Enter +Type "git config user.name 'Your Name'" +Enter +Sleep 500ms + +Type "git checkout -b awesome-docs" +Enter +Sleep 500ms + +# Initialize commitizen config with shortcuts enabled +Type `cat > pyproject.toml << 'EOF'` +Enter +Sleep 100ms +Type `[tool.commitizen]` +Enter +Sleep 100ms +Type `name = "cz_conventional_commits"` +Enter +Sleep 100ms +Type `use_shortcuts = true` +Enter +Sleep 100ms +Type "EOF" +Enter +Sleep 300ms + +# Create a dummy file to commit +Type "echo 'test content' > README.md" +Enter +Sleep 300ms + +Type "git add README.md" +Enter +Sleep 300ms + +# Clear the screen to start fresh +Type "clear" +Enter +Sleep 500ms + +# Show commands from here +Show + +# Now run cz commit +Type "cz commit" +Sleep 500ms +Enter + +# Wait for first prompt to appear +Sleep 2s + +# Question 1: Select the type of change (press d to "docs") +Sleep 1s +Type "d" +Sleep 2s +Enter +Sleep 1s + +# Question 2: Scope (optional, skip) +Enter +Sleep 1s + +# Question 3: Subject +Type "demo with custom keys" +Sleep 500ms +Enter +Sleep 500ms + +# Question 4: Is this a BREAKING CHANGE? (No) +Enter +Sleep 500ms + +# Question 5: Body (optional, skip) +Enter +Sleep 500ms + +# Question 6: Footer (optional, skip) +Enter +Sleep 500ms + +# Wait for commit success message +Sleep 1s diff --git a/mkdocs.yml b/mkdocs.yml index a38dcd276..21d6376c5 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -6,6 +6,8 @@ theme: name: material logo: images/cz_logo.png favicon: images/cz_logo.png + features: + - content.code.copy palette: # Palette toggle for automatic mode - media: "(prefers-color-scheme)" @@ -55,7 +57,7 @@ nav: - changelog: "config/changelog.md" - Misc Options: "config/option.md" - Advanced Customization: - - Configuration File: "customization/config_file.md" + - Customize via config file: "customization/config_file.md" - Customized Python Class: "customization/python_class.md" - Changelog Template: "customization/changelog_template.md" - Tutorials: @@ -105,6 +107,8 @@ markdown_extensions: - name: mermaid class: mermaid format: !!python/name:pymdownx.superfences.fence_code_format + - pymdownx.tabbed: + alternate_style: true plugins: - search