aboutsummaryrefslogtreecommitdiffsponsor
diff options
context:
space:
mode:
-rw-r--r--cmd/mirror/main.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/cmd/mirror/main.go b/cmd/mirror/main.go
index 8276a10..e823039 100644
--- a/cmd/mirror/main.go
+++ b/cmd/mirror/main.go
@@ -2,21 +2,26 @@ package main
import (
"flag"
+ "fmt"
"log"
"os"
"git.server.ky/slackcoder/mirror/internal/service"
)
+// Program version
+var Version string
+
type Flags struct {
Config string
- Mirrors string
+ Version bool
}
func ParseFlags() *Flags {
var flags Flags
flag.StringVar(&flags.Config, "config", "/etc/mirror/mirror.toml", "configuration file")
+ flag.BoolVar(&flags.Version, "version", false, "print version")
flag.Parse()
return &flags
@@ -32,6 +37,11 @@ func exitOnError(err error) {
func main() {
flags := ParseFlags()
+ if flags.Version {
+ fmt.Println(Version)
+ os.Exit(0)
+ }
+
cfg, err := service.ReadConfig(flags.Config)
exitOnError(err)