verbose output parameter

This commit is contained in:
Andrey Meshkov 2018-12-29 00:49:39 +03:00
parent 8fc5aebf12
commit f312575da4

6
app.go
View File

@ -3,7 +3,6 @@ package main
import ( import (
"bufio" "bufio"
"fmt" "fmt"
"log"
"net" "net"
"net/http" "net/http"
"os" "os"
@ -14,6 +13,7 @@ import (
"time" "time"
"github.com/gobuffalo/packr" "github.com/gobuffalo/packr"
log "github.com/sirupsen/logrus"
"golang.org/x/crypto/ssh/terminal" "golang.org/x/crypto/ssh/terminal"
) )
@ -62,6 +62,7 @@ func main() {
} }
bindPort = &v bindPort = &v
}}, }},
{"verbose", "v", "enable verbose output", nil},
{"help", "h", "print this help", nil}, {"help", "h", "print this help", nil},
} }
printHelp := func() { printHelp := func() {
@ -79,6 +80,9 @@ func main() {
printHelp() printHelp()
os.Exit(64) os.Exit(64)
} }
if v == "--verbose" || v == "-v" {
log.SetLevel(log.TraceLevel)
}
knownParam := false knownParam := false
for _, opt := range opts { for _, opt := range opts {
if v == "--"+opt.longName { if v == "--"+opt.longName {