Skip to content

Commit 6fdf979

Browse files
committed
add command line option to display application version
1 parent 1d9898a commit 6fdf979

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

cmd/iffmaster/main.go

+26-4
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,38 @@
44
/*
55
Iffmaster is a tool to inspect IFF files as defined under EA-85.
66
7-
Usage:
7+
Usage: [options]
88
99
iffmaster
1010
11-
There aren't any command line options yet.
11+
-version: Show the application's version.
1212
*/
1313
package main
1414

15-
import "github.com/mattrust/iffmaster/internal/gui"
15+
import (
16+
"flag"
17+
"fmt"
18+
"os"
19+
20+
"github.com/mattrust/iffmaster/internal/gui"
21+
)
22+
23+
const version = "1.0.0"
1624

1725
func main() {
18-
gui.OpenGUI()
26+
showVersion := flag.Bool("version", false, "Display the version of iffmaster")
27+
flag.Parse()
28+
29+
if *showVersion {
30+
fmt.Println("iffmaster version", version)
31+
os.Exit(0)
32+
}
33+
34+
if flag.NArg() > 0 {
35+
//filename := flag.Arg(0)
36+
//fmt.Println("Filename provided:", filename)
37+
// You can add code here to handle the filename, e.g., open the file
38+
} else {
39+
gui.OpenGUI()
40+
}
1941
}

0 commit comments

Comments
 (0)