Skip to content

Commit

Permalink
Merge pull request #46 from jessp01/add-version-info
Browse files Browse the repository at this point in the history
Add version info and filename to usage()
  • Loading branch information
jessp01 authored Sep 26, 2023
2 parents 34af9a0 + c461ac1 commit 82a58e0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/md2pdf/md2pdf.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"os"
"path/filepath"
"regexp"
"runtime"
"strings"

"github.com/mandolyte/mdtopdf"
Expand All @@ -30,6 +31,8 @@ var pageSize = flag.String("page-size", "A4", "[A3 | A4 | A5]")
var orientation = flag.String("orientation", "portrait", "[portrait | landscape]")
var logFile = flag.String("log-file", "md2pdf_trace.log", "Path to log file")
var help = flag.Bool("help", false, "Show usage message")
var version = "dev"
var _, fileName, fileLine, ok = runtime.Caller(0)

var opts []mdtopdf.RenderOption

Expand Down Expand Up @@ -159,7 +162,7 @@ func main() {

func usage(msg string) {
fmt.Println(msg + "\n")
fmt.Print("Usage: convert [options]\n")
fmt.Printf("Usage: %s (%s) [options]\n", filepath.Base(fileName), version)
flag.PrintDefaults()
os.Exit(0)
}

0 comments on commit 82a58e0

Please sign in to comment.