github.com/mckael/restic@v0.8.3/cmd/restic/cmd_version.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"runtime"
     6  
     7  	"github.com/spf13/cobra"
     8  )
     9  
    10  var versionCmd = &cobra.Command{
    11  	Use:   "version",
    12  	Short: "Print version information",
    13  	Long: `
    14  The "version" command prints detailed information about the build environment
    15  and the version of this software.
    16  `,
    17  	DisableAutoGenTag: true,
    18  	Run: func(cmd *cobra.Command, args []string) {
    19  		fmt.Printf("restic %s\ncompiled with %v on %v/%v\n",
    20  			version, runtime.Version(), runtime.GOOS, runtime.GOARCH)
    21  	},
    22  }
    23  
    24  func init() {
    25  	cmdRoot.AddCommand(versionCmd)
    26  }