fix usage func

This commit is contained in:
Andrea Franz 2018-11-08 15:03:50 +01:00
parent 4b99feff82
commit 9e30d84ebf
No known key found for this signature in database
GPG Key ID: 4F0D2F2D9DE7F29D
3 changed files with 20 additions and 11 deletions

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
wallet.cap
/build
*.cap
/applets

9
Makefile Normal file
View File

@ -0,0 +1,9 @@
.PHONY: build
GOBIN = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))build/bin
BIN_NAME="status-hardware-wallet"
build:
go build -i -o $(GOBIN)/$(BIN_NAME) -v ./cmd/status-hardware-wallet
@echo "Compilation done."
@echo "Run \"build/bin/$(BIN_NAME) -h\" to view available commands."

View File

@ -24,7 +24,7 @@ var (
flagCapFile = flag.String("a", "", "applet cap file path")
flagOverwrite = flag.Bool("f", false, "force applet installation if already installed")
flagLogLevel = flag.String("l", "", `Log level, one of: "ERROR", "WARN", "INFO", "DEBUG", and "TRACE"`)
flagLogLevel = flag.String("l", "", `Log level, one of: "error", "warn", "info", "debug", and "trace"`)
)
func initLogger() {
@ -43,6 +43,15 @@ func initLogger() {
}
func init() {
commands = map[string]commandFunc{
"install": commandInstall,
"info": commandInfo,
"delete": commandDelete,
"init": commandInit,
"pair": commandPair,
"status": commandStatus,
}
if len(os.Args) < 2 {
usage()
}
@ -53,15 +62,6 @@ func init() {
}
initLogger()
commands = map[string]commandFunc{
"install": commandInstall,
"info": commandInfo,
"delete": commandDelete,
"init": commandInit,
"pair": commandPair,
"status": commandStatus,
}
}
func usage() {