aboutsummaryrefslogtreecommitdiffstats
path: root/commands/webui.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-19 12:30:25 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-19 12:36:01 +0200
commit7f5922f905831a85ffee4c9226b65715899ba758 (patch)
treed18a29a2ec13706efa7f5e9efc9515a92cf4513d /commands/webui.go
parent459bb8747d9e84493b8d04a3172e6758452a75b9 (diff)
downloadgit-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.go17
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)
}