-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
298 additions
and
1,193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package cmd | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
func init() { | ||
rootCmd.AddCommand(changePinCmd) | ||
} | ||
|
||
var changePinCmd = &cobra.Command{ | ||
Use: "changePin", | ||
Short: "Change or add a pin to the device", | ||
Long: "Change or add a pin to the device", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
if err := kk.ChangePin(); err != nil { | ||
log.Fatal(err) | ||
} | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,24 @@ | ||
package cmd | ||
|
||
import "fmt" | ||
import ( | ||
"log" | ||
|
||
func main() { | ||
fmt.Println("vim-go") | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func init() { | ||
rootCmd.AddCommand(pingCmd) | ||
} | ||
|
||
var pingCmd = &cobra.Command{ | ||
Use: "ping", | ||
Short: "Ping the device with a message", | ||
Long: `Ping the device with a message and optionally, | ||
display it on the device.`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
_, err := kk.Ping("butt", true, true, true) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package cmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"os" | ||
|
||
"github.com/solipsis/go-keepkey/pkg/keepkey" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var kk *keepkey.Keepkey | ||
|
||
func init() { | ||
cobra.OnInitialize(connectDevice) | ||
} | ||
|
||
func connectDevice() { | ||
var err error | ||
kk, err = keepkey.GetDevice() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
} | ||
|
||
var rootCmd = &cobra.Command{ | ||
Use: "go-keepkey", | ||
Short: "go-keepkey blah short description", | ||
Long: "long", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
|
||
fmt.Println("how does this work") | ||
}, | ||
} | ||
|
||
func Execute() { | ||
if err := rootCmd.Execute(); err != nil { | ||
fmt.Println(err) | ||
os.Exit(1) | ||
} | ||
} |
Binary file not shown.
Oops, something went wrong.