forked from TrueCloudLab/restic
Add 'version' command
This commit is contained in:
parent
9c742c7b4b
commit
bcb19c811b
2 changed files with 36 additions and 0 deletions
32
cmd/restic/cmd_version.go
Normal file
32
cmd/restic/cmd_version.go
Normal 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
4
version.go
Normal file
|
@ -0,0 +1,4 @@
|
|||
package restic
|
||||
|
||||
var Version = "compiled manually"
|
||||
var Features = []string{}
|
Loading…
Reference in a new issue