Make config backwards-compatible

This commit is contained in:
Manuel Rüger 2023-04-20 12:43:08 +02:00
parent 262853f6c0
commit 2f44bcb6be
2 changed files with 22 additions and 21 deletions

View File

@ -603,26 +603,25 @@ USAGE:
mark [global options] [arguments...] mark [global options] [arguments...]
GLOBAL OPTIONS: GLOBAL OPTIONS:
--files value, -f value use specified markdown file(s) for converting to html. Supports file globbing patterns (needs to be quoted). [$MARK_FILES] --files value, -f value use specified markdown file(s) for converting to html. Supports file globbing patterns (needs to be quoted). [$MARK_FILES]
--compile-only show resulting HTML and don't update Confluence page content. (default: false) [$MARK_COMPILE_ONLY] --compile-only show resulting HTML and don't update Confluence page content. (default: false) [$MARK_COMPILE_ONLY]
--dry-run resolve page and ancestry, show resulting HTML and exit. (default: false) [$MARK_DRY_RUN] --dry-run resolve page and ancestry, show resulting HTML and exit. (default: false) [$MARK_DRY_RUN]
--edit-lock, -k lock page editing to current user only to prevent accidental manual edits over Confluence Web UI. (default: false) [$MARK_EDIT_LOCK] --edit-lock, -k lock page editing to current user only to prevent accidental manual edits over Confluence Web UI. (default: false) [$MARK_EDIT_LOCK]
--drop-h1 don't include H1 headings in Confluence output. (default: false) [$MARK_H1_DROP] --drop-h1, --h1_drop don't include H1 headings in Confluence output. (default: false) [$MARK_H1_DROP]
--title-from-h1 extract page title from a leading H1 heading. If no H1 heading on a page exists, then title must be set in the page metadata. (default: false) [$MARK_H1_TITLE] --title-from-h1, --h1_title extract page title from a leading H1 heading. If no H1 heading on a page exists, then title must be set in the page metadata. (default: false) [$MARK_H1_TITLE]
--minor-edit don't send notifications while updating Confluence page. (default: false) [$MARK_MINOR_EDIT] --minor-edit don't send notifications while updating Confluence page. (default: false) [$MARK_MINOR_EDIT]
--color value display logs in color. Possible values: auto, never. (default: "auto") [$MARK_COLOR] --color value display logs in color. Possible values: auto, never. (default: "auto") [$MARK_COLOR]
--debug enable debug logs. (default: false) [$MARK_DEBUG] --debug enable debug logs. (default: false) [$MARK_DEBUG]
--trace enable trace logs. (default: false) [$MARK_TRACE] --trace enable trace logs. (default: false) [$MARK_TRACE]
--username value, -u value use specified username for updating Confluence page. [$MARK_USERNAME] --username value, -u value use specified username for updating Confluence page. [$MARK_USERNAME]
--password value, -p value use specified token for updating Confluence page. Specify - as password to read password from stdin, or your Personal access token. Username is not mandatory if personal access token is provided. For more info please see: https://developer.atlassian.com/server/confluence/confluence-server-rest-api/#authentication. [$MARK_PASSWORD] --password value, -p value use specified token for updating Confluence page. Specify - as password to read password from stdin, or your Personal access token. Username is not mandatory if personal access token is provided. For more info please see: https://developer.atlassian.com/server/confluence/confluence-server-rest-api/#authentication. [$MARK_PASSWORD]
--target-url value, -l value edit specified Confluence page. If -l is not specified, file should contain metadata (see above). [$MARK_TARGET_URL] --target-url value, -l value edit specified Confluence page. If -l is not specified, file should contain metadata (see above). [$MARK_TARGET_URL]
--base-url value, -b value base URL for Confluence. Alternative option for base_url config field. [$MARK_BASE_URL] --base-url value, -b value, --base_url value base URL for Confluence. Alternative option for base_url config field. [$MARK_BASE_URL]
--config value, -c value use the specified configuration file. (default: "/home/mruger/.config/mark") [$MARK_CONFIG] --config value, -c value use the specified configuration file. (default: "/home/mruger/.config/mark") [$MARK_CONFIG]
--ci run on CI mode. It won't fail if files are not found. (default: false) [$MARK_CI] --ci run on CI mode. It won't fail if files are not found. (default: false) [$MARK_CI]
--space value use specified space key. If the space key is not specified, it must be set in the page metadata. [$MARK_SPACE] --space value use specified space key. If the space key is not specified, it must be set in the page metadata. [$MARK_SPACE]
--help, -h show help --help, -h show help
--version, -v print the version --version, -v print the version
``` ```
You can store user credentials in the configuration file, which should be You can store user credentials in the configuration file, which should be

View File

@ -56,12 +56,14 @@ var flags = []cli.Flag{
altsrc.NewBoolFlag(&cli.BoolFlag{ altsrc.NewBoolFlag(&cli.BoolFlag{
Name: "drop-h1", Name: "drop-h1",
Value: false, Value: false,
Aliases: []string{"h1_drop"},
Usage: "don't include H1 headings in Confluence output.", Usage: "don't include H1 headings in Confluence output.",
EnvVars: []string{"MARK_H1_DROP"}, EnvVars: []string{"MARK_H1_DROP"},
}), }),
altsrc.NewBoolFlag(&cli.BoolFlag{ altsrc.NewBoolFlag(&cli.BoolFlag{
Name: "title-from-h1", Name: "title-from-h1",
Value: false, Value: false,
Aliases: []string{"h1_title"},
Usage: "extract page title from a leading H1 heading. If no H1 heading on a page exists, then title must be set in the page metadata.", Usage: "extract page title from a leading H1 heading. If no H1 heading on a page exists, then title must be set in the page metadata.",
EnvVars: []string{"MARK_H1_TITLE"}, EnvVars: []string{"MARK_H1_TITLE"},
}), }),
@ -112,7 +114,7 @@ var flags = []cli.Flag{
}), }),
altsrc.NewStringFlag(&cli.StringFlag{ altsrc.NewStringFlag(&cli.StringFlag{
Name: "base-url", Name: "base-url",
Aliases: []string{"b"}, Aliases: []string{"b", "base_url"},
Value: "", Value: "",
Usage: "base URL for Confluence. Alternative option for base_url config field.", Usage: "base URL for Confluence. Alternative option for base_url config field.",
EnvVars: []string{"MARK_BASE_URL"}, EnvVars: []string{"MARK_BASE_URL"},