aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--commands/webui.go12
-rw-r--r--doc/bash_completion/git-bug3
-rw-r--r--doc/man/git-bug-webui.34
-rw-r--r--doc/md/git-bug_webui.md3
4 files changed, 18 insertions, 4 deletions
diff --git a/commands/webui.go b/commands/webui.go
index eef15d24..c4db2ae6 100644
--- a/commands/webui.go
+++ b/commands/webui.go
@@ -12,10 +12,15 @@ import (
"net/http"
)
+var port int
+
func runWebUI(cmd *cobra.Command, args []string) error {
- port, err := freeport.GetFreePort()
- if err != nil {
- log.Fatal(err)
+ if port == 0 {
+ var err error
+ port, err = freeport.GetFreePort()
+ if err != nil {
+ log.Fatal(err)
+ }
}
addr := fmt.Sprintf("127.0.0.1:%d", port)
@@ -50,4 +55,5 @@ var webUICmd = &cobra.Command{
func init() {
RootCmd.AddCommand(webUICmd)
+ webUICmd.Flags().IntVarP(&port, "port", "p", 0, "Port to listen to")
}
diff --git a/doc/bash_completion/git-bug b/doc/bash_completion/git-bug
index b357f4e0..7ab85fca 100644
--- a/doc/bash_completion/git-bug
+++ b/doc/bash_completion/git-bug
@@ -475,6 +475,9 @@ _git-bug_webui()
flags_with_completion=()
flags_completion=()
+ flags+=("--port=")
+ two_word_flags+=("-p")
+ local_nonpersistent_flags+=("--port=")
must_have_one_flag=()
must_have_one_noun=()
diff --git a/doc/man/git-bug-webui.3 b/doc/man/git-bug-webui.3
index 8bba041d..ea182ff2 100644
--- a/doc/man/git-bug-webui.3
+++ b/doc/man/git-bug-webui.3
@@ -23,6 +23,10 @@ Launch the web UI
\fB\-h\fP, \fB\-\-help\fP[=false]
help for webui
+.PP
+\fB\-p\fP, \fB\-\-port\fP=0
+ Port to listen to
+
.SH SEE ALSO
.PP
diff --git a/doc/md/git-bug_webui.md b/doc/md/git-bug_webui.md
index caa1b975..52192260 100644
--- a/doc/md/git-bug_webui.md
+++ b/doc/md/git-bug_webui.md
@@ -13,7 +13,8 @@ git-bug webui [flags]
### Options
```
- -h, --help help for webui
+ -h, --help help for webui
+ -p, --port int Port to listen to
```
### SEE ALSO