From bcb19c811bc8f507022210555de8bbb0ffd97428 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Fri, 16 Jan 2015 21:26:33 +0100 Subject: [PATCH] Add 'version' command --- cmd/restic/cmd_version.go | 32 ++++++++++++++++++++++++++++++++ version.go | 4 ++++ 2 files changed, 36 insertions(+) create mode 100644 cmd/restic/cmd_version.go create mode 100644 version.go diff --git a/cmd/restic/cmd_version.go b/cmd/restic/cmd_version.go new file mode 100644 index 000000000..d9fadbcc2 --- /dev/null +++ b/cmd/restic/cmd_version.go @@ -0,0 +1,32 @@ +package main + +import ( + "fmt" + "runtime" + + "github.com/restic/restic" +) + +type CmdVersion struct{} + +func init() { + _, err := parser.AddCommand("version", + "display version", + "The version command displays detailed information about the version", + &CmdVersion{}) + if err != nil { + panic(err) + } +} + +func (cmd CmdVersion) Execute(args []string) error { + fmt.Printf("restic version %s, lib %v on %v\n", version, restic.Version, runtime.Version()) + for _, s := range features { + fmt.Printf(" %s\n", s) + } + for _, s := range restic.Features { + fmt.Printf(" %s\n", s) + } + + return nil +} diff --git a/version.go b/version.go new file mode 100644 index 000000000..a8f729d33 --- /dev/null +++ b/version.go @@ -0,0 +1,4 @@ +package restic + +var Version = "compiled manually" +var Features = []string{}