aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--commands/webui.go8
-rw-r--r--doc/man/git-bug-webui.14
-rw-r--r--doc/md/git-bug_webui.md13
-rw-r--r--misc/bash_completion/git-bug4
4 files changed, 23 insertions, 6 deletions
diff --git a/commands/webui.go b/commands/webui.go
index d910a703..3857e968 100644
--- a/commands/webui.go
+++ b/commands/webui.go
@@ -6,6 +6,7 @@ import (
"log"
"net"
"net/http"
+ "net/url"
"os"
"os/signal"
"strconv"
@@ -34,6 +35,7 @@ type webUIOptions struct {
open bool
noOpen bool
readOnly bool
+ query string
}
func newWebUICommand() *cobra.Command {
@@ -62,6 +64,7 @@ Available git config:
flags.BoolVar(&options.noOpen, "no-open", false, "Prevent the automatic opening of the web UI in the default browser")
flags.IntVarP(&options.port, "port", "p", 0, "Port to listen to (default to random available port)")
flags.BoolVar(&options.readOnly, "read-only", false, "Whether to run the web UI in read-only mode")
+ flags.StringVar(&options.query, "query", "", "Set a custom query")
return cmd
}
@@ -78,6 +81,11 @@ func runWebUI(env *Env, opts webUIOptions, args []string) error {
addr := net.JoinHostPort(opts.host, strconv.Itoa(opts.port))
webUiAddr := fmt.Sprintf("http://%s", addr)
+ if len(opts.query) > 0 {
+ // Explicitly set the query parameter instead of going with a default one.
+ webUiAddr = fmt.Sprintf("%s/?q=%s", webUiAddr, url.QueryEscape(opts.query))
+ }
+
router := mux.NewRouter()
// If the webUI is not read-only, use an authentication middleware with a
diff --git a/doc/man/git-bug-webui.1 b/doc/man/git-bug-webui.1
index 6e4622be..6bed9143 100644
--- a/doc/man/git-bug-webui.1
+++ b/doc/man/git-bug-webui.1
@@ -42,6 +42,10 @@ Available git config:
Whether to run the web UI in read\-only mode
.PP
+\fB\-\-query\fP=""
+ Set a custom query
+
+.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
help for webui
diff --git a/doc/md/git-bug_webui.md b/doc/md/git-bug_webui.md
index ccfaff9a..0cdfd517 100644
--- a/doc/md/git-bug_webui.md
+++ b/doc/md/git-bug_webui.md
@@ -17,12 +17,13 @@ git-bug webui [flags]
### Options
```
- --host string Network address or hostname to listen to (default to 127.0.0.1) (default "127.0.0.1")
- --open Automatically open the web UI in the default browser
- --no-open Prevent the automatic opening of the web UI in the default browser
- -p, --port int Port to listen to (default to random available port)
- --read-only Whether to run the web UI in read-only mode
- -h, --help help for webui
+ --host string Network address or hostname to listen to (default to 127.0.0.1) (default "127.0.0.1")
+ --open Automatically open the web UI in the default browser
+ --no-open Prevent the automatic opening of the web UI in the default browser
+ -p, --port int Port to listen to (default to random available port)
+ --read-only Whether to run the web UI in read-only mode
+ --query string Set a custom query
+ -h, --help help for webui
```
### SEE ALSO
diff --git a/misc/bash_completion/git-bug b/misc/bash_completion/git-bug
index 8f2a0f8f..7c7cd975 100644
--- a/misc/bash_completion/git-bug
+++ b/misc/bash_completion/git-bug
@@ -1347,6 +1347,10 @@ _git-bug_webui()
local_nonpersistent_flags+=("-p")
flags+=("--read-only")
local_nonpersistent_flags+=("--read-only")
+ flags+=("--query=")
+ two_word_flags+=("--query")
+ local_nonpersistent_flags+=("--query")
+ local_nonpersistent_flags+=("--query=")
must_have_one_flag=()
must_have_one_noun=()