mirror of
https://github.com/kovetskiy/mark.git
synced 2025-04-24 05:42:40 +08:00
Add option to pass a version message
This commit is contained in:
parent
b7cb1824ae
commit
9b91ee3344
8
main.go
8
main.go
@ -84,6 +84,12 @@ var flags = []cli.Flag{
|
|||||||
Usage: "don't send notifications while updating Confluence page.",
|
Usage: "don't send notifications while updating Confluence page.",
|
||||||
EnvVars: []string{"MARK_MINOR_EDIT"},
|
EnvVars: []string{"MARK_MINOR_EDIT"},
|
||||||
}),
|
}),
|
||||||
|
altsrc.NewStringFlag(&cli.StringFlag{
|
||||||
|
Name: "version-message",
|
||||||
|
Value: "",
|
||||||
|
Usage: "add a message to the page version, to explain the edit (default: \"\")",
|
||||||
|
EnvVars: []string{"MARK_VERSION_MESSAGE"},
|
||||||
|
}),
|
||||||
altsrc.NewStringFlag(&cli.StringFlag{
|
altsrc.NewStringFlag(&cli.StringFlag{
|
||||||
Name: "color",
|
Name: "color",
|
||||||
Value: "auto",
|
Value: "auto",
|
||||||
@ -511,7 +517,7 @@ func processFile(
|
|||||||
html = buffer.String()
|
html = buffer.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
err = api.UpdatePage(target, html, cCtx.Bool("minor-edit"), meta.Labels, meta.ContentAppearance)
|
err = api.UpdatePage(target, html, cCtx.Bool("minor-edit"), cCtx.String("version-message"), meta.Labels, meta.ContentAppearance)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -503,7 +503,7 @@ func (api *API) CreatePage(
|
|||||||
return request.Response.(*PageInfo), nil
|
return request.Response.(*PageInfo), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *API) UpdatePage(page *PageInfo, newContent string, minorEdit bool, newLabels []string, appearance string) error {
|
func (api *API) UpdatePage(page *PageInfo, newContent string, minorEdit bool, versionMessage string, newLabels []string, appearance string) error {
|
||||||
nextPageVersion := page.Version.Number + 1
|
nextPageVersion := page.Version.Number + 1
|
||||||
oldAncestors := []map[string]interface{}{}
|
oldAncestors := []map[string]interface{}{}
|
||||||
|
|
||||||
@ -532,6 +532,7 @@ func (api *API) UpdatePage(page *PageInfo, newContent string, minorEdit bool, ne
|
|||||||
"version": map[string]interface{}{
|
"version": map[string]interface{}{
|
||||||
"number": nextPageVersion,
|
"number": nextPageVersion,
|
||||||
"minorEdit": minorEdit,
|
"minorEdit": minorEdit,
|
||||||
|
"message": versionMessage,
|
||||||
},
|
},
|
||||||
"ancestors": oldAncestors,
|
"ancestors": oldAncestors,
|
||||||
"body": map[string]interface{}{
|
"body": map[string]interface{}{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user