diff options
author | Michael Muré <batolettre@gmail.com> | 2018-07-19 12:30:25 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-07-19 12:36:01 +0200 |
commit | 7f5922f905831a85ffee4c9226b65715899ba758 (patch) | |
tree | d18a29a2ec13706efa7f5e9efc9515a92cf4513d /commands/webui.go | |
parent | 459bb8747d9e84493b8d04a3172e6758452a75b9 (diff) | |
download | git-bug-7f5922f905831a85ffee4c9226b65715899ba758.tar.gz |
rework all the commands to use cobra as a parser
Diffstat (limited to 'commands/webui.go')
-rw-r--r-- | commands/webui.go | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/commands/webui.go b/commands/webui.go index df18d3b9..737632c3 100644 --- a/commands/webui.go +++ b/commands/webui.go @@ -2,16 +2,16 @@ package commands import ( "fmt" - "github.com/MichaelMure/git-bug/repository" "github.com/MichaelMure/git-bug/webui" "github.com/gorilla/mux" "github.com/phayes/freeport" "github.com/skratchdot/open-golang/open" + "github.com/spf13/cobra" "log" "net/http" ) -func runWebUI(repo repository.Repo, args []string) error { +func runWebUI(cmd *cobra.Command, args []string) error { port, err := freeport.GetFreePort() if err != nil { log.Fatal(err) @@ -29,9 +29,12 @@ func runWebUI(repo repository.Repo, args []string) error { return nil } -var webUICmd = &Command{ - Description: "Launch the web UI", - Usage: "", - flagSet: nil, - RunMethod: runWebUI, +var webUICmd = &cobra.Command{ + Use: "webui", + Short: "Launch the web UI", + RunE: runWebUI, +} + +func init() { + rootCmd.AddCommand(webUICmd) } |