Skip to content

Commit 9f9b687

Browse files
committed
Add information on JSON output format to documentation of 'prepare-release' command
1 parent 6760633 commit 9f9b687

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

doc/nbgv-cli.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,49 @@ The behaviour of the `prepare-release` command can be customized in
121121
| versionIncrement | `minor` | Specifies which part of the version on the current branch is incremented when preparing a release. Allowed values are `major`, `minor` and `build`. |
122122
| firstUnstableTag | `alpha` | Specified the unstable tag to use for the main branch. |
123123

124+
### Customizing the `prepare-release` output format
125+
126+
By default, the `prepare-release` command writes information about created and updated branches to the console as text.
127+
Alternatively the information can be written to the output as `json`.
128+
The output format to use can be set using the `--format` command line parameter.
129+
130+
For example, running the follwoing command on `master`
131+
132+
```
133+
nbgv prepare-release --format json
134+
```
135+
136+
will generate output similar to this:
137+
138+
```json
139+
{
140+
"CurrentBranch": {
141+
"Name": "master",
142+
"Commit": "5a7487098ac1be1ceb4dbf72d862539cf0b0c27a",
143+
"Version": "1.7-alpha"
144+
},
145+
"NewBranch": {
146+
"Name": "v1.7",
147+
"Commit": "b2f164675ffe891b66b601c00efc4343581fc8a5",
148+
"Version": "1.7"
149+
}
150+
}
151+
```
152+
153+
The JSON object has to properties:
154+
155+
- `CurrentBranch` provides information about the branch `prepare-release` was started on (typically `master`)
156+
- `NewBranch` provides information about the new branch created by the command.
157+
158+
For each branch, the following proprties are provided:
159+
160+
- `Name`: The name of the branch
161+
- `Commit`: The id of the latest commit on that branch
162+
- `Version`: The version configured in that branch's `version.json`
163+
164+
**Note:** When the current branch is already the release branch for the current version, no new branch will be created.
165+
In that case, the `NewBranch` property will be `null`.
166+
124167
## Learn more
125168

126169
There are several more sub-commands and switches to each to help you build and maintain your projects, find a commit that built a particular version later on, create tags, etc.

0 commit comments

Comments
 (0)