File tree Expand file tree Collapse file tree 16 files changed +44
-13
lines changed
Expand file tree Collapse file tree 16 files changed +44
-13
lines changed Original file line number Diff line number Diff line change 11package main
22
33import (
4+ "os"
5+
46 "github.com/alecthomas/kong"
7+ log "github.com/sirupsen/logrus"
58
69 "github.com/pushbits/cli/internal/application"
710 "github.com/pushbits/cli/internal/commands"
@@ -16,8 +19,21 @@ var cmd struct {
1619 Version commands.VersionCommand `cmd:"version" aliases:"v" help:"Print the program version"`
1720}
1821
22+ func init () {
23+ log .SetOutput (os .Stderr )
24+ log .SetLevel (log .InfoLevel )
25+ log .SetFormatter (& log.TextFormatter {
26+ DisableTimestamp : true ,
27+ })
28+ }
29+
1930func main () {
2031 ctx := kong .Parse (& cmd )
32+
33+ if cmd .Verbose {
34+ log .SetLevel (log .DebugLevel )
35+ }
36+
2137 err := ctx .Run (& cmd .Options )
2238 ctx .FatalIfErrorf (err )
2339}
Original file line number Diff line number Diff line change 44
55require (
66 github.com/alecthomas/kong v0.5.0
7+ github.com/sirupsen/logrus v1.8.1
78 golang.org/x/term v0.0.0-20210503060354-a79de5458b56
89)
910
Original file line number Diff line number Diff line change @@ -9,9 +9,13 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
99github.com/pkg/errors v0.9.1 /go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0 =
1010github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM =
1111github.com/pmezard/go-difflib v1.0.0 /go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4 =
12+ github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE =
13+ github.com/sirupsen/logrus v1.8.1 /go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0 =
1214github.com/stretchr/objx v0.1.0 /go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME =
15+ github.com/stretchr/testify v1.2.2 /go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs =
1316github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY =
1417github.com/stretchr/testify v1.7.0 /go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg =
18+ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 /go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs =
1519golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 /go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs =
1620golang.org/x/sys v0.0.0-20210603125802-9665404d3644 h1:CA1DEQ4NdKphKeL70tvsWNdT5oFh1lOjihRcEDROi0I =
1721golang.org/x/sys v0.0.0-20210603125802-9665404d3644 /go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg =
Original file line number Diff line number Diff line change @@ -4,10 +4,11 @@ import (
44 "encoding/json"
55 "io"
66 "io/ioutil"
7- "log"
87 "net/http"
98 "net/url"
109 "strings"
10+
11+ log "github.com/sirupsen/logrus"
1112)
1213
1314func buildURL (baseStr string , endpoint string ) * url.URL {
Original file line number Diff line number Diff line change 11package application
22
33import (
4- " log"
4+ log "github.com/sirupsen/logrus "
55
66 "github.com/pushbits/cli/internal/api"
77 "github.com/pushbits/cli/internal/options"
Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ package application
22
33import (
44 "fmt"
5- "log"
5+
6+ log "github.com/sirupsen/logrus"
67
78 "github.com/pushbits/cli/internal/api"
89 "github.com/pushbits/cli/internal/options"
Original file line number Diff line number Diff line change 11package application
22
33import (
4- " log"
4+ log "github.com/sirupsen/logrus "
55
66 "github.com/pushbits/cli/internal/api"
77 "github.com/pushbits/cli/internal/options"
Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ package application
22
33import (
44 "fmt"
5- "log"
5+
6+ log "github.com/sirupsen/logrus"
67
78 "github.com/pushbits/cli/internal/api"
89 "github.com/pushbits/cli/internal/options"
Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ package application
22
33import (
44 "fmt"
5- "log"
5+
6+ log "github.com/sirupsen/logrus"
67
78 "github.com/pushbits/cli/internal/api"
89 "github.com/pushbits/cli/internal/options"
Original file line number Diff line number Diff line change 11package options
22
33// Options represents the global options.
4- type Options struct {}
4+ type Options struct {
5+ Verbose bool `short:"v" help:"Show debugging information"`
6+ }
57
68// AuthOptions represents the options for authentication against a server.
79type AuthOptions struct {
You can’t perform that action at this time.
0 commit comments