Add 'version' command

This commit is contained in:
Alexander Neumann 2015-01-16 21:26:33 +01:00
parent 9c742c7b4b
commit bcb19c811b
2 changed files with 36 additions and 0 deletions

32
cmd/restic/cmd_version.go Normal file
View File

@ -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
}

4
version.go Normal file
View File

@ -0,0 +1,4 @@
package restic
var Version = "compiled manually"
var Features = []string{}