-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add extensive documentation for the 'show' subcommand
This commit adds extensive documentation for the `show` subcommand in the program's reference. It also includes smaller updates and corrections to other parts of the documentation. An in-depth example usage of `show` is added both to the dedicated `show.md` file and in the function's docstring.
- Loading branch information
Showing
6 changed files
with
82 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# CLI Reference | ||
|
||
::: mkdocs-click | ||
:module: bumpversion.cli | ||
:command: cli | ||
|
This file contains 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 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 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,9 @@ | ||
# Subcommand reference | ||
|
||
Bump-my-version uses subcommands to focus its functionality. | ||
|
||
- `bump` triggers the version incrementing workflow | ||
- `replace` replaces the version in files without triggering a version increment. | ||
- `sample-config` helps new users configure bumpy-my-version by printing a sample configuration file. | ||
- `show` provides access to current configuration information. | ||
- `show-bump` helps developers understand the current versioning convention by showing the possible versions resulting from the `bump` subcommand. |
This file contains 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,53 @@ | ||
# The show subcommand | ||
|
||
The main purpose of the `show` subcommand is to provide access to configuration data via scripts. | ||
|
||
## Basic use | ||
|
||
The configuration object is a `dict` containing nested data structures. The arguments and options of this command relate to extracting data from the configuration object and presenting the extracted data. | ||
|
||
## Specifying the output data | ||
|
||
The positional arguments determine the data shown. If nothing or `all` is passed, the entire configuration is shown. | ||
|
||
Positional arguments are specified using a format like [Django variable resolution](https://docs.djangoproject.com/en/5.0/ref/templates/language/#variables). | ||
|
||
Examples: | ||
|
||
- `a.b` specifies the "b" key in the nested dictionaries: `{"a": {"b": "value"}}` | ||
- `a.3` specifies the 4th item (the first is 0) of the list at key "a": `{"a": ["no", "nay", "nyet", "value"]}` | ||
|
||
## Specifying the output format | ||
|
||
If only one positional argument is passed, the default format only shows its value. If no positional arguments, several positional arguments, or `all` is passed, the output from [`pprint.pprint`](https://docs.python.org/3.12/library/pprint.html#pprint.pprint) is shown. | ||
|
||
This makes getting the current version easy: | ||
|
||
```console | ||
$ bump-my-version show current_version | ||
1.0.1 | ||
``` | ||
|
||
You can request the output be formatted as YAML or JSON: | ||
|
||
```console | ||
$ bump-my-version show --format yaml current_version | ||
current_version: "1.0.1" | ||
$ bump-my-version show --format json current_version | ||
{ | ||
"current_version": "1.0.1" | ||
} | ||
``` | ||
|
||
## Including the incremented version before bumping | ||
|
||
Your workflow might want to know the new version before you actually do the bumping. The `--increment` or `-i` option accepts a version part to bump and adds a `new_version` key into the configuration. | ||
|
||
```console | ||
$ bump-my-version --increment patch show | ||
1.0.2 | ||
$ bump-my-version --increment minor show | ||
1.1.0 | ||
$ bump-my-version --increment major show | ||
2.0.0 | ||
``` |