diff options
author | Rohan Verma <hello@rohanverma.net> | 2018-10-24 14:16:50 +0530 |
---|---|---|
committer | Rohan Verma <hello@rohanverma.net> | 2018-10-24 14:16:50 +0530 |
commit | d23f52c45d98ac058eb3502e3ee8354e431cab0e (patch) | |
tree | f85a0faac2bcacc5f792f114d504a1531977fa87 /up.go | |
parent | f8832c5f62c562ba0a1c18723c7a12f4e510cf94 (diff) |
feat: use pflag instead of flag
Diffstat (limited to 'up.go')
-rw-r--r-- | up.go | 16 |
1 files changed, 4 insertions, 12 deletions
@@ -21,7 +21,6 @@ import ( "bufio" "bytes" "context" - "flag" "fmt" "io" "io/ioutil" @@ -30,6 +29,8 @@ import ( "os/exec" "sync" + flag "github.com/spf13/pflag" + "github.com/gdamore/tcell" "github.com/mattn/go-isatty" ) @@ -64,20 +65,15 @@ import ( // Flag Settings var ( - debugMode bool + debugMode = flag.Bool("debug", false, "debug mode") ) -func init() { - flag.BoolVar(&debugMode, "debug", false, "debug mode") - flag.BoolVar(&debugMode, "d", false, "debug mode (shorthand)") -} - func main() { // Handle command-line flags flag.Parse() log.SetOutput(ioutil.Discard) - if debugMode { + if *debugMode { debug, err := os.Create("up.debug") if err != nil { die(err.Error()) @@ -182,10 +178,6 @@ func main() { } } -func parseFlags() { - -} - func initTUI() tcell.Screen { // TODO: Without below block, we'd hang when nothing is piped on input (see // github.com/peco/peco, mattn/gof, fzf, etc.) |