Skip to content

Commit 4b7a14f

Browse files
committed
add -version flag
1 parent 0fc1d4c commit 4b7a14f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

pmdump.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ import (
99
"github.com/papermerge/pmdump/config"
1010
)
1111

12+
const PMDUMP_VERSION = "0.2"
13+
1214
var configFile = flag.String("c", "", "path to config file")
1315
var targetFile = flag.String("f", "", "Target file - zipped tar archive file name were to dump")
16+
var version = flag.Bool("version", false, "show version and exit")
1417

1518
const exportYaml = "export.yaml"
1619
const exportCommand = "export"
@@ -19,8 +22,28 @@ const importCommand = "import"
1922
func main() {
2023
flag.Parse()
2124

25+
flag.Usage = func() {
26+
w := flag.CommandLine.Output()
27+
28+
fmt.Fprintf(
29+
w,
30+
"Usage: %s [-c config.yaml] [-f archive.tar.gz] export | import \n",
31+
os.Args[0],
32+
)
33+
34+
flag.PrintDefaults()
35+
36+
fmt.Fprintf(w, "For more details check: https://github.com/papermerge/pmdump\n")
37+
38+
}
39+
2240
args := flag.Args()
2341

42+
if *version {
43+
fmt.Println(PMDUMP_VERSION)
44+
os.Exit(0)
45+
}
46+
2447
if *configFile == "" {
2548
fmt.Fprintf(os.Stderr, "Missing configuration. Did you forget -c flag?\n")
2649
flag.Usage()

0 commit comments

Comments
 (0)