This repository has been archived by the owner on Nov 27, 2023. It is now read-only.
-
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.
oasis-core-ledger: Add a basic device listing tool
- Loading branch information
Showing
7 changed files
with
95 additions
and
5 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
ledger-signer/ledger-signer.so | ||
oasis-core-ledger |
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
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,17 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/oasisprotocol/oasis-core-ledger/internal" | ||
) | ||
|
||
var listCmd = &cobra.Command{ | ||
Use: "list_devices", | ||
Short: "list available devices by address", | ||
Run: doList, | ||
} | ||
|
||
func doList(cmd *cobra.Command, args []string) { | ||
internal.ListOasisDevices(internal.ListingDerivationPath) | ||
} |
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,56 @@ | ||
// Package cmd implements the oasis-core-ledger tool. | ||
package cmd | ||
|
||
import ( | ||
// "fmt" | ||
|
||
"github.com/spf13/cobra" | ||
// flag "github.com/spf13/pflag" | ||
// "github.com/spf13/viper" | ||
// "github.com/oasisprotocol/oasis-core/go/common/logging" | ||
// "github.com/oasisprotocol/oasis-core/go/oasis-node/cmd/common" | ||
) | ||
|
||
// const cfgLogLevel = "log.level" | ||
|
||
var rootCmd = &cobra.Command{ | ||
Use: "oasis-core-ledger", | ||
Short: "Oasis Ledger Tool", | ||
Version: "0.0.1", | ||
} | ||
|
||
// rootFlags = flag.NewFlagSet("", flag.ContinueOnError) | ||
|
||
// RootCommand returns the root (top level) cobra.Command. | ||
func RootCommand() *cobra.Command { | ||
return rootCmd | ||
} | ||
|
||
// Execute spawns the main entry point after handling the command line arguments. | ||
func Execute() { | ||
// Blah, The fact that oasis-core imports the ledger library causes | ||
// issues, re-enable logging once the ledger support has been purged. | ||
/* | ||
var logLevel logging.Level | ||
if err := logLevel.Set(viper.GetString(cfgLogLevel)); err != nil { | ||
common.EarlyLogAndExit(fmt.Errorf("root: failed to set log level: %w", err)) | ||
} | ||
if err := rootCmd.Execute(); err != nil { | ||
common.EarlyLogAndExit(err) | ||
} | ||
*/ | ||
_ = rootCmd.Execute() | ||
} | ||
|
||
func init() { // nolint: gochecknoinits | ||
/* | ||
logLevel := logging.LevelInfo | ||
rootFlags.Var(&logLevel, cfgLogLevel, "log level") | ||
_ = viper.BindPFlags(rootFlags) | ||
rootCmd.PersistentFlags().AddFlagSet(rootFlags) | ||
*/ | ||
|
||
// Register all of the sub-commands. | ||
rootCmd.AddCommand(listCmd) | ||
} |
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
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
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,10 @@ | ||
// Package main implements the oasis-core-ledger CLI tool. | ||
package main | ||
|
||
import ( | ||
"github.com/oasisprotocol/oasis-core-ledger/cmd" | ||
) | ||
|
||
func main() { | ||
cmd.Execute() | ||
} |