mirror of
https://github.com/kovetskiy/mark.git
synced 2025-04-23 21:32:41 +08:00
add config parameter
This commit is contained in:
parent
a5221cbedd
commit
b1eea83d49
@ -342,8 +342,7 @@ mark -h | --help
|
|||||||
- `-b <url>` or `--base-url <url>` – Base URL for Confluence.
|
- `-b <url>` or `--base-url <url>` – Base URL for Confluence.
|
||||||
Alternative option for `base_url` config field.
|
Alternative option for `base_url` config field.
|
||||||
- `-f <file>` — Use specified markdown file(s) for converting to html. Supports file globbing patterns (needs to be quoted).
|
- `-f <file>` — Use specified markdown file(s) for converting to html. Supports file globbing patterns (needs to be quoted).
|
||||||
- `-c <file>` — Specify configuration file which should be used for reading
|
- `-c <path>` or `--config <path>` — Specify a path to the configuration file.
|
||||||
Confluence page URL and markdown file path.
|
|
||||||
- `-k` — Lock page editing to current user only to prevent accidental
|
- `-k` — Lock page editing to current user only to prevent accidental
|
||||||
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.
|
||||||
@ -354,11 +353,11 @@ mark -h | --help
|
|||||||
- `-h | --help` — Show help screen and call 911.
|
- `-h | --help` — Show help screen and call 911.
|
||||||
|
|
||||||
You can store user credentials in the configuration file, which should be
|
You can store user credentials in the configuration file, which should be
|
||||||
located in ~/.config/mark with the following format (TOML):
|
located in ~/.config/mark (or specified via `-c --config <path>`) with the following format (TOML):
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
username = "smith"
|
username = "your-email"
|
||||||
password = "matrixishere"
|
password = "password-or-api-key-for-confluence-cloud"
|
||||||
# If you are using Confluence Cloud add the /wiki suffix to base_url
|
# If you are using Confluence Cloud add the /wiki suffix to base_url
|
||||||
base_url = "http://confluence.local"
|
base_url = "http://confluence.local"
|
||||||
```
|
```
|
||||||
|
12
main.go
12
main.go
@ -32,6 +32,7 @@ type Flags struct {
|
|||||||
Password string `docopt:"-p"`
|
Password string `docopt:"-p"`
|
||||||
TargetURL string `docopt:"-l"`
|
TargetURL string `docopt:"-l"`
|
||||||
BaseURL string `docopt:"--base-url"`
|
BaseURL string `docopt:"--base-url"`
|
||||||
|
Config string `docopt:"--config"`
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -55,7 +56,8 @@ Options:
|
|||||||
above).
|
above).
|
||||||
-b --base-url <url> Base URL for Confluence.
|
-b --base-url <url> Base URL for Confluence.
|
||||||
Alternative option for base_url config field.
|
Alternative option for base_url config field.
|
||||||
-f <file> Use specified markdown file(s) for converting to html. Supports file globbing patterns (needs to be quoted).
|
-f <file> Use specified markdown file(s) for converting to html.
|
||||||
|
Supports file globbing patterns (needs to be quoted).
|
||||||
-k Lock page editing to current user only to prevent accidental
|
-k Lock page editing to current user only to prevent accidental
|
||||||
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.
|
||||||
@ -66,13 +68,15 @@ Options:
|
|||||||
--trace Enable trace logs.
|
--trace Enable trace logs.
|
||||||
--color <when> Display logs in color. Possible values: auto, never.
|
--color <when> Display logs in color. Possible values: auto, never.
|
||||||
[default: auto]
|
[default: auto]
|
||||||
-h --help Show this screen and call 911.
|
-c --config <path> Use the specified configuration file.
|
||||||
|
[default: $HOME/.config/mark]
|
||||||
|
-h --help Show this message.
|
||||||
-v --version Show version.
|
-v --version Show version.
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
cmd, err := docopt.ParseArgs(usage, nil, version)
|
cmd, err := docopt.ParseArgs(os.ExpandEnv(usage), nil, version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -100,7 +104,7 @@ func main() {
|
|||||||
log.GetLogger().SetOutput(os.Stderr)
|
log.GetLogger().SetOutput(os.Stderr)
|
||||||
}
|
}
|
||||||
|
|
||||||
config, err := LoadConfig(filepath.Join(os.Getenv("HOME"), ".config/mark"))
|
config, err := LoadConfig(flags.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user