mirror of
https://github.com/hairyhenderson/go-onerng.git
synced 2025-07-08 03:15:08 -05:00
Some incomplete initial code
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
This commit is contained in:
26
cmd/version.go
Normal file
26
cmd/version.go
Normal file
@ -0,0 +1,26 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/hairyhenderson/go-onerng"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// versionCmd represents the version command
|
||||
func versionCmd(ctx context.Context) *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Display the OneRNG's hardware version",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
o := onerng.OneRNG{Path: opts.Device}
|
||||
version, err := o.Version(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("OneRNG Hardware Version: %d\n", version)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user