-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CLI command for visor version output
- Loading branch information
1 parent
9014c82
commit f49ec5b
Showing
1 changed file
with
27 additions
and
0 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,27 @@ | ||
package node | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
func init() { | ||
RootCmd.AddCommand(buildInfoCmd) | ||
} | ||
|
||
var buildInfoCmd = &cobra.Command{ | ||
Use: "version", | ||
Short: "Obtains version and build info of the node", | ||
Run: func(_ *cobra.Command, _ []string) { | ||
client := rpcClient() | ||
summary, err := client.Summary() | ||
if err != nil { | ||
log.Fatal("Failed to connect:", err) | ||
} | ||
|
||
if _, err := summary.BuildInfo.WriteTo(os.Stdout); err != nil { | ||
log.Fatal("Failed to output build info:", err) | ||
} | ||
}, | ||
} |