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