Add --minor-edit command-line flag

This commit is contained in:
Rolf Ahrenberg 2021-01-04 15:42:34 +02:00
parent f86dd2723a
commit 1d8e43add2
3 changed files with 8 additions and 3 deletions

View File

@ -270,6 +270,7 @@ mark -h | --help
manual edits over Confluence Web UI. manual edits over Confluence Web UI.
- `--drop-h1` Don't include H1 headings in Confluence output. - `--drop-h1` Don't include H1 headings in Confluence output.
- `--dry-run` — Show resulting HTML and don't update Confluence page content. - `--dry-run` — Show resulting HTML and don't update Confluence page content.
- `--minor-edit` — Don't send notifications while updating Confluence page.
- `--trace` — Enable trace logs. - `--trace` — Enable trace logs.
- `-v | --version` — Show version. - `-v | --version` — Show version.
- `-h | --help` — Show help screen and call 911. - `-h | --help` — Show help screen and call 911.
@ -284,6 +285,8 @@ password = "matrixishere"
base_url = "http://confluence.local" base_url = "http://confluence.local"
``` ```
**NOTE**: Labels aren't supported when using `minor-edit`!
# Tricks # Tricks
## Continuous Integration ## Continuous Integration

View File

@ -43,6 +43,7 @@ Options:
--drop-h1 Don't include H1 headings in Confluence output. --drop-h1 Don't include H1 headings in Confluence output.
--dry-run Resolve page and ancestry, show resulting HTML and exit. --dry-run Resolve page and ancestry, show resulting HTML and exit.
--compile-only Show resulting HTML and don't update Confluence page content. --compile-only Show resulting HTML and don't update Confluence page content.
--minor-edit Don't send notifications while updating Confluence page.
--debug Enable debug logs. --debug Enable debug logs.
--trace Enable trace logs. --trace Enable trace logs.
-h --help Show this screen and call 911. -h --help Show this screen and call 911.
@ -62,6 +63,7 @@ func main() {
dryRun = args["--dry-run"].(bool) dryRun = args["--dry-run"].(bool)
editLock = args["-k"].(bool) editLock = args["-k"].(bool)
dropH1 = args["--drop-h1"].(bool) dropH1 = args["--drop-h1"].(bool)
minorEdit = args["--minor-edit"].(bool)
) )
if args["--debug"].(bool) { if args["--debug"].(bool) {
@ -240,7 +242,7 @@ func main() {
html = buffer.String() html = buffer.String()
} }
err = api.UpdatePage(target, html, meta.Labels) err = api.UpdatePage(target, html, minorEdit, meta.Labels)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }

View File

@ -434,7 +434,7 @@ func (api *API) CreatePage(
} }
func (api *API) UpdatePage( func (api *API) UpdatePage(
page *PageInfo, newContent string, newLabels []string, page *PageInfo, newContent string, minorEdit bool, newLabels []string,
) error { ) error {
nextPageVersion := page.Version.Number + 1 nextPageVersion := page.Version.Number + 1
@ -467,7 +467,7 @@ func (api *API) UpdatePage(
"title": page.Title, "title": page.Title,
"version": map[string]interface{}{ "version": map[string]interface{}{
"number": nextPageVersion, "number": nextPageVersion,
"minorEdit": false, "minorEdit": minorEdit,
}, },
"ancestors": oldAncestors, "ancestors": oldAncestors,
"body": map[string]interface{}{ "body": map[string]interface{}{