add version command

This commit is contained in:
Andrea Franz 2019-04-03 12:09:48 +02:00
parent ae4aeeafc4
commit 0bb56e9716
No known key found for this signature in database
GPG Key ID: 4F0D2F2D9DE7F29D
1 changed files with 8 additions and 0 deletions

View File

@ -15,6 +15,8 @@ import (
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
) )
const version = "0.0.2"
type commandFunc func(*scard.Card) error type commandFunc func(*scard.Card) error
var ( var (
@ -45,6 +47,7 @@ func initLogger() {
func init() { func init() {
commands = map[string]commandFunc{ commands = map[string]commandFunc{
"version": commandVersion,
"install": commandInstall, "install": commandInstall,
"info": commandInfo, "info": commandInfo,
"delete": commandDelete, "delete": commandDelete,
@ -204,6 +207,11 @@ func askInt(description string) int {
return int(i) return int(i)
} }
func commandVersion(card *scard.Card) error {
fmt.Printf("version %+v\n", version)
return nil
}
func commandInstall(card *scard.Card) error { func commandInstall(card *scard.Card) error {
if *flagCapFile == "" { if *flagCapFile == "" {
logger.Error("you must specify a cap file path with the -f flag\n") logger.Error("you must specify a cap file path with the -f flag\n")