return nil instead of exiting, check for nil in loop

This commit is contained in:
iyz 2025-02-17 15:31:53 -05:00 committed by Manuel Rüger
parent 611e8e9b94
commit 076165c137

16
main.go
View File

@ -286,13 +286,15 @@ func RunMark(cCtx *cli.Context) error {
target := processFile(file, api, cCtx, creds.PageID, creds.Username) target := processFile(file, api, cCtx, creds.PageID, creds.Username)
log.Infof( if target != nil { // on dry-run or compile-only, the target is nil
nil, log.Infof(
"page successfully updated: %s", nil,
creds.BaseURL+target.Links.Full, "page successfully updated: %s",
) creds.BaseURL+target.Links.Full,
)
fmt.Println(creds.BaseURL + target.Links.Full) fmt.Println(creds.BaseURL + target.Links.Full)
}
} }
return nil return nil
} }
@ -415,7 +417,7 @@ func processFile(
html, _ := mark.CompileMarkdown(markdown, stdlib, file, cCtx.String("mermaid-provider"), cCtx.Float64("mermaid-scale"), cCtx.Bool("drop-h1"), cCtx.Bool("strip-linebreaks")) html, _ := mark.CompileMarkdown(markdown, stdlib, file, cCtx.String("mermaid-provider"), cCtx.Float64("mermaid-scale"), cCtx.Bool("drop-h1"), cCtx.Bool("strip-linebreaks"))
fmt.Println(html) fmt.Println(html)
os.Exit(0) return nil
} }
var target *confluence.PageInfo var target *confluence.PageInfo