The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/distrobuilder/pull/245

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Thomas Hipp <thomas.h...@canonical.com>
From 5e911f01bfb934a348863576503d9f7c61e68408 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.h...@canonical.com>
Date: Mon, 14 Oct 2019 11:08:22 +0200
Subject: [PATCH] Add version

Signed-off-by: Thomas Hipp <thomas.h...@canonical.com>
---
 distrobuilder/main.go     | 7 +++++++
 shared/version/version.go | 4 ++++
 2 files changed, 11 insertions(+)
 create mode 100644 shared/version/version.go

diff --git a/distrobuilder/main.go b/distrobuilder/main.go
index 3594339..0142f58 100644
--- a/distrobuilder/main.go
+++ b/distrobuilder/main.go
@@ -68,6 +68,7 @@ import (
        "gopkg.in/yaml.v2"
 
        "github.com/lxc/distrobuilder/shared"
+       "github.com/lxc/distrobuilder/shared/version"
        "github.com/lxc/distrobuilder/sources"
 )
 
@@ -76,6 +77,7 @@ type cmdGlobal struct {
        flagCacheDir string
        flagOptions  []string
        flagTimeout  uint
+       flagVersion  bool
 
        definition *shared.Definition
        sourceDir  string
@@ -119,6 +121,11 @@ func main() {
                []string{}, "Override options (list of key=value)"+"``")
        app.PersistentFlags().UintVarP(&globalCmd.flagTimeout, "timeout", "t", 
0,
                "Timeout in seconds"+"``")
+       app.PersistentFlags().BoolVar(&globalCmd.flagVersion, "version", false, 
"Print version number")
+
+       // Version handling
+       app.SetVersionTemplate("{{.Version}}\n")
+       app.Version = version.Version
 
        // LXC sub-commands
        LXCCmd := cmdLXC{global: &globalCmd}
diff --git a/shared/version/version.go b/shared/version/version.go
new file mode 100644
index 0000000..47b68d7
--- /dev/null
+++ b/shared/version/version.go
@@ -0,0 +1,4 @@
+package version
+
+// Version contains the distrobuilder version number
+var Version = "1.0"
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to