mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-13 20:13:15 +03:00
webui: Add flag to specify which port to listen to
This commit is contained in:
parent
94623b2a82
commit
8f0bb154b0
@ -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")
|
||||
}
|
||||
|
@ -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=()
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user