Add version display
This commit is contained in:
parent
ae794d9d59
commit
d182adba8c
2 changed files with 23 additions and 3 deletions
|
@ -143,12 +143,23 @@ func writeFile(dst string, contents []byte) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var version = "v0+HEAD"
|
||||
|
||||
func main() {
|
||||
var outputDir, workingDir string
|
||||
var (
|
||||
outputDir, workingDir string
|
||||
isVersionCmd bool
|
||||
)
|
||||
flag.StringVar(&outputDir, "output", outputBase, "output directory (will be created if missing)")
|
||||
flag.StringVar(&workingDir, "working", "", "working directory (defaults to current directory)")
|
||||
flag.BoolVar(&isVersionCmd, "version", false, "display version")
|
||||
flag.Parse()
|
||||
|
||||
if isVersionCmd {
|
||||
println("gmnhg", version)
|
||||
return
|
||||
}
|
||||
|
||||
if workingDir != "" {
|
||||
if err := os.Chdir(workingDir); err != nil {
|
||||
panic(err)
|
||||
|
|
|
@ -25,14 +25,23 @@ import (
|
|||
gemini "git.tdem.in/tdemin/gmnhg"
|
||||
)
|
||||
|
||||
var version = "v0+HEAD"
|
||||
|
||||
func main() {
|
||||
var (
|
||||
input string
|
||||
file *os.File
|
||||
input string
|
||||
file *os.File
|
||||
isVersionCmd bool
|
||||
)
|
||||
flag.StringVar(&input, "f", "", "input file")
|
||||
flag.BoolVar(&isVersionCmd, "version", false, "display version")
|
||||
flag.Parse()
|
||||
|
||||
if isVersionCmd {
|
||||
println("md2gmn", version)
|
||||
return
|
||||
}
|
||||
|
||||
if input != "" {
|
||||
var err error
|
||||
file, err = os.Open(input)
|
||||
|
|
Loading…
Reference in a new issue