mirror of
https://github.com/kovetskiy/mark.git
synced 2025-04-23 21:32:41 +08:00
option to turn off color output, close #69
This commit is contained in:
parent
b17a955ec7
commit
400b85de11
16
main.go
16
main.go
@ -47,6 +47,8 @@ Options:
|
|||||||
--minor-edit Don't send notifications while updating Confluence page.
|
--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.
|
||||||
|
--color <when> Display logs in color. Possible values: auto, never.
|
||||||
|
[default: auto]
|
||||||
-h --help Show this screen and call 911.
|
-h --help Show this screen and call 911.
|
||||||
-v --version Show version.
|
-v --version Show version.
|
||||||
`
|
`
|
||||||
@ -65,6 +67,7 @@ func main() {
|
|||||||
editLock = args["-k"].(bool)
|
editLock = args["-k"].(bool)
|
||||||
dropH1 = args["--drop-h1"].(bool)
|
dropH1 = args["--drop-h1"].(bool)
|
||||||
minorEdit = args["--minor-edit"].(bool)
|
minorEdit = args["--minor-edit"].(bool)
|
||||||
|
color = args["--color"].(string)
|
||||||
)
|
)
|
||||||
|
|
||||||
if args["--debug"].(bool) {
|
if args["--debug"].(bool) {
|
||||||
@ -75,6 +78,15 @@ func main() {
|
|||||||
log.SetLevel(lorg.LevelTrace)
|
log.SetLevel(lorg.LevelTrace)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if color == "never" {
|
||||||
|
log.GetLogger().SetFormat(
|
||||||
|
lorg.NewFormat(
|
||||||
|
`${time:2006-01-02 15:04:05.000} ${level:%s:left:true} ${prefix}%s`,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
log.GetLogger().SetOutput(os.Stderr)
|
||||||
|
}
|
||||||
|
|
||||||
config, err := LoadConfig(filepath.Join(os.Getenv("HOME"), ".config/mark"))
|
config, err := LoadConfig(filepath.Join(os.Getenv("HOME"), ".config/mark"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
@ -216,7 +228,9 @@ func main() {
|
|||||||
markdown = mark.CompileAttachmentLinks(markdown, attaches)
|
markdown = mark.CompileAttachmentLinks(markdown, attaches)
|
||||||
|
|
||||||
if dropH1 {
|
if dropH1 {
|
||||||
log.Info("Leading H1 heading will be excluded from the Confluence output")
|
log.Info(
|
||||||
|
"Leading H1 heading will be excluded from the Confluence output",
|
||||||
|
)
|
||||||
markdown = mark.DropDocumentLeadingH1(markdown)
|
markdown = mark.DropDocumentLeadingH1(markdown)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user