aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bridge/core/bridge.go4
-rw-r--r--bridge/core/interfaces.go4
-rw-r--r--bridge/github/config.go12
-rw-r--r--bridge/gitlab/config.go14
-rw-r--r--bridge/jira/config.go49
-rw-r--r--bridge/launchpad/config.go5
-rw-r--r--commands/add.go10
-rw-r--r--commands/bridge_configure.go18
-rw-r--r--commands/comment_add.go10
-rw-r--r--commands/comment_edit.go10
-rw-r--r--commands/title_edit.go8
-rw-r--r--commands/user_create.go14
-rw-r--r--doc/man/git-bug-add.14
-rw-r--r--doc/man/git-bug-bridge-configure.14
-rw-r--r--doc/man/git-bug-comment-add.14
-rw-r--r--doc/man/git-bug-comment-edit.14
-rw-r--r--doc/man/git-bug-title-edit.14
-rw-r--r--doc/man/git-bug-user-create.14
-rw-r--r--doc/md/git-bug_add.md9
-rw-r--r--doc/md/git-bug_bridge_configure.md1
-rw-r--r--doc/md/git-bug_comment_add.md7
-rw-r--r--doc/md/git-bug_comment_edit.md7
-rw-r--r--doc/md/git-bug_title_edit.md5
-rw-r--r--doc/md/git-bug_user_create.md9
-rw-r--r--misc/bash_completion/git-bug12
-rw-r--r--webui/src/components/Header/Header.tsx9
-rw-r--r--webui/src/components/Themer.tsx21
27 files changed, 182 insertions, 80 deletions
diff --git a/bridge/core/bridge.go b/bridge/core/bridge.go
index 8c1f9714..b410b470 100644
--- a/bridge/core/bridge.go
+++ b/bridge/core/bridge.go
@@ -202,10 +202,10 @@ func RemoveBridge(repo repository.RepoConfig, name string) error {
}
// Configure run the target specific configuration process
-func (b *Bridge) Configure(params BridgeParams) error {
+func (b *Bridge) Configure(params BridgeParams, interactive bool) error {
validateParams(params, b.impl)
- conf, err := b.impl.Configure(b.repo, params)
+ conf, err := b.impl.Configure(b.repo, params, interactive)
if err != nil {
return err
}
diff --git a/bridge/core/interfaces.go b/bridge/core/interfaces.go
index 47dbd63b..3d212f29 100644
--- a/bridge/core/interfaces.go
+++ b/bridge/core/interfaces.go
@@ -20,8 +20,8 @@ type BridgeImpl interface {
NewExporter() Exporter
// Configure handle the user interaction and return a key/value configuration
- // for future use
- Configure(repo *cache.RepoCache, params BridgeParams) (Configuration, error)
+ // for future use.
+ Configure(repo *cache.RepoCache, params BridgeParams, interactive bool) (Configuration, error)
// The set of the BridgeParams fields supported
ValidParams() map[string]interface{}
diff --git a/bridge/github/config.go b/bridge/github/config.go
index 55a09c53..9889f403 100644
--- a/bridge/github/config.go
+++ b/bridge/github/config.go
@@ -40,7 +40,7 @@ func (g *Github) ValidParams() map[string]interface{} {
}
}
-func (g *Github) Configure(repo *cache.RepoCache, params core.BridgeParams) (core.Configuration, error) {
+func (g *Github) Configure(repo *cache.RepoCache, params core.BridgeParams, interactive bool) (core.Configuration, error) {
var err error
var owner string
var project string
@@ -60,6 +60,9 @@ func (g *Github) Configure(repo *cache.RepoCache, params core.BridgeParams) (cor
}
default:
// terminal prompt
+ if !interactive {
+ return nil, fmt.Errorf("Non-interactive-mode is active. Please specify the remote repository with --owner and --project, or via --url option.")
+ }
owner, project, err = promptURL(repo)
if err != nil {
return nil, err
@@ -99,6 +102,9 @@ func (g *Github) Configure(repo *cache.RepoCache, params core.BridgeParams) (cor
cred = token
default:
if params.Login == "" {
+ if !interactive {
+ return nil, fmt.Errorf("Non-interactive-mode is active. Please specify a login via the --login option.")
+ }
login, err = promptLogin()
} else {
// validate login and override with the correct case
@@ -110,6 +116,10 @@ func (g *Github) Configure(repo *cache.RepoCache, params core.BridgeParams) (cor
if err != nil {
return nil, err
}
+
+ if !interactive {
+ return nil, fmt.Errorf("Non-interactive-mode is active. Please specify a access token via the --token option.")
+ }
cred, err = promptTokenOptions(repo, login, owner, project)
if err != nil {
return nil, err
diff --git a/bridge/gitlab/config.go b/bridge/gitlab/config.go
index dfac4c54..3496b4a3 100644
--- a/bridge/gitlab/config.go
+++ b/bridge/gitlab/config.go
@@ -32,7 +32,7 @@ func (g *Gitlab) ValidParams() map[string]interface{} {
}
}
-func (g *Gitlab) Configure(repo *cache.RepoCache, params core.BridgeParams) (core.Configuration, error) {
+func (g *Gitlab) Configure(repo *cache.RepoCache, params core.BridgeParams, interactive bool) (core.Configuration, error) {
var err error
var baseUrl string
@@ -40,6 +40,9 @@ func (g *Gitlab) Configure(repo *cache.RepoCache, params core.BridgeParams) (cor
case params.BaseURL != "":
baseUrl = params.BaseURL
default:
+ if !interactive {
+ return nil, fmt.Errorf("Non-interactive-mode is active. Please specify the gitlab instance URL via the --base-url option.")
+ }
baseUrl, err = input.PromptDefault("Gitlab server URL", "URL", defaultBaseURL, input.Required, input.IsURL)
if err != nil {
return nil, errors.Wrap(err, "base url prompt")
@@ -54,6 +57,9 @@ func (g *Gitlab) Configure(repo *cache.RepoCache, params core.BridgeParams) (cor
projectURL = params.URL
default:
// terminal prompt
+ if !interactive {
+ return nil, fmt.Errorf("Non-interactive-mode is active. Please specify the gitlab project URL via the --url option.")
+ }
projectURL, err = promptProjectURL(repo, baseUrl)
if err != nil {
return nil, errors.Wrap(err, "url prompt")
@@ -89,6 +95,9 @@ func (g *Gitlab) Configure(repo *cache.RepoCache, params core.BridgeParams) (cor
cred = token
default:
if params.Login == "" {
+ if !interactive {
+ return nil, fmt.Errorf("Non-interactive-mode is active. Please specify the login name via the --login option.")
+ }
// TODO: validate username
login, err = input.Prompt("Gitlab login", "login", input.Required)
} else {
@@ -98,6 +107,9 @@ func (g *Gitlab) Configure(repo *cache.RepoCache, params core.BridgeParams) (cor
if err != nil {
return nil, err
}
+ if !interactive {
+ return nil, fmt.Errorf("Non-interactive-mode is active. Please specify the access token via the --token option.")
+ }
cred, err = promptTokenOptions(repo, login, baseUrl)
if err != nil {
return nil, err
diff --git a/bridge/jira/config.go b/bridge/jira/config.go
index 717046e2..3ce6ad9a 100644
--- a/bridge/jira/config.go
+++ b/bridge/jira/config.go
@@ -33,15 +33,19 @@ func (*Jira) ValidParams() map[string]interface{} {
"Login": nil,
"CredPrefix": nil,
"Project": nil,
+ "TokenRaw": nil,
}
}
// Configure sets up the bridge configuration
-func (j *Jira) Configure(repo *cache.RepoCache, params core.BridgeParams) (core.Configuration, error) {
+func (j *Jira) Configure(repo *cache.RepoCache, params core.BridgeParams, interactive bool) (core.Configuration, error) {
var err error
baseURL := params.BaseURL
if baseURL == "" {
+ if !interactive {
+ return nil, fmt.Errorf("Non-interactive-mode is active. Please specify the JIRA server URL via the --base-url option.")
+ }
// terminal prompt
baseURL, err = input.Prompt("JIRA server URL", "URL", input.Required, input.IsURL)
if err != nil {
@@ -51,20 +55,17 @@ func (j *Jira) Configure(repo *cache.RepoCache, params core.BridgeParams) (core.
project := params.Project
if project == "" {
+ if !interactive {
+ return nil, fmt.Errorf("Non-interactive-mode is active. Please specify the JIRA project key via the --project option.")
+ }
project, err = input.Prompt("JIRA project key", "project", input.Required)
if err != nil {
return nil, err
}
}
- fmt.Println(credTypeText)
- credTypeInput, err := input.PromptChoice("Authentication mechanism", []string{"SESSION", "TOKEN"})
- if err != nil {
- return nil, err
- }
- credType := []string{"SESSION", "TOKEN"}[credTypeInput]
-
var login string
+ var credType string
var cred auth.Credential
switch {
@@ -80,18 +81,34 @@ func (j *Jira) Configure(repo *cache.RepoCache, params core.BridgeParams) (core.
login = l
default:
if params.Login == "" {
- // TODO: validate username
+ if !interactive {
+ return nil, fmt.Errorf("Non-interactive-mode is active. Please specify the login name via the --login option.")
+ }
login, err = input.Prompt("JIRA login", "login", input.Required)
+ if err != nil {
+ return nil, err
+ }
} else {
- // TODO: validate username
login = params.Login
}
- if err != nil {
- return nil, err
- }
- cred, err = promptCredOptions(repo, login, baseURL)
- if err != nil {
- return nil, err
+ // TODO: validate username
+
+ if params.TokenRaw == "" {
+ if !interactive {
+ return nil, fmt.Errorf("Non-interactive-mode is active. Please specify the access token via the --token option.")
+ }
+ fmt.Println(credTypeText)
+ credTypeInput, err := input.PromptChoice("Authentication mechanism", []string{"SESSION", "TOKEN"})
+ if err != nil {
+ return nil, err
+ }
+ credType = []string{"SESSION", "TOKEN"}[credTypeInput]
+ cred, err = promptCredOptions(repo, login, baseURL)
+ if err != nil {
+ return nil, err
+ }
+ } else {
+ credType = "TOKEN"
}
}
diff --git a/bridge/launchpad/config.go b/bridge/launchpad/config.go
index e2eb86da..f97714bd 100644
--- a/bridge/launchpad/config.go
+++ b/bridge/launchpad/config.go
@@ -20,7 +20,7 @@ func (Launchpad) ValidParams() map[string]interface{} {
}
}
-func (l *Launchpad) Configure(repo *cache.RepoCache, params core.BridgeParams) (core.Configuration, error) {
+func (l *Launchpad) Configure(repo *cache.RepoCache, params core.BridgeParams, interactive bool) (core.Configuration, error) {
var err error
var project string
@@ -31,6 +31,9 @@ func (l *Launchpad) Configure(repo *cache.RepoCache, params core.BridgeParams) (
// get project name from url
project, err = splitURL(params.URL)
default:
+ if !interactive {
+ return nil, fmt.Errorf("Non-interactive-mode is active. Please specify the project name with the --project option.")
+ }
// get project name from terminal prompt
project, err = input.Prompt("Launchpad project name", "project name", input.Required)
}
diff --git a/commands/add.go b/commands/add.go
index ad3b164b..3a28c424 100644
--- a/commands/add.go
+++ b/commands/add.go
@@ -8,9 +8,10 @@ import (
)
type addOptions struct {
- title string
- message string
- messageFile string
+ title string
+ message string
+ messageFile string
+ nonInteractive bool
}
func newAddCommand() *cobra.Command {
@@ -36,6 +37,7 @@ func newAddCommand() *cobra.Command {
"Provide a message to describe the issue")
flags.StringVarP(&options.messageFile, "file", "F", "",
"Take the message from the given file. Use - to read the message from the standard input")
+ flags.BoolVar(&options.nonInteractive, "non-interactive", false, "Do not ask for user input")
return cmd
}
@@ -49,7 +51,7 @@ func runAdd(env *Env, opts addOptions) error {
}
}
- if opts.messageFile == "" && (opts.message == "" || opts.title == "") {
+ if !opts.nonInteractive && opts.messageFile == "" && (opts.message == "" || opts.title == "") {
opts.title, opts.message, err = input.BugCreateEditorInput(env.backend, opts.title, opts.message)
if err == input.ErrEmptyTitle {
diff --git a/commands/bridge_configure.go b/commands/bridge_configure.go
index ecdb6502..c0ce1461 100644
--- a/commands/bridge_configure.go
+++ b/commands/bridge_configure.go
@@ -16,11 +16,12 @@ import (
)
type bridgeConfigureOptions struct {
- name string
- target string
- params core.BridgeParams
- token string
- tokenStdin bool
+ name string
+ target string
+ params core.BridgeParams
+ token string
+ tokenStdin bool
+ nonInteractive bool
}
func newBridgeConfigureCommand() *cobra.Command {
@@ -105,6 +106,7 @@ git bug bridge configure \
flags.BoolVar(&options.tokenStdin, "token-stdin", false, "Will read the token from stdin and ignore --token")
flags.StringVarP(&options.params.Owner, "owner", "o", "", "The owner of the remote repository")
flags.StringVarP(&options.params.Project, "project", "p", "", "The name of the remote repository")
+ flags.BoolVar(&options.nonInteractive, "non-interactive", false, "Do not ask for user input")
return cmd
}
@@ -136,14 +138,14 @@ func runBridgeConfigure(env *Env, opts bridgeConfigureOptions) error {
opts.params.TokenRaw = opts.token
}
- if opts.target == "" {
+ if !opts.nonInteractive && opts.target == "" {
opts.target, err = promptTarget()
if err != nil {
return err
}
}
- if opts.name == "" {
+ if !opts.nonInteractive && opts.name == "" {
opts.name, err = promptName(env.repo)
if err != nil {
return err
@@ -155,7 +157,7 @@ func runBridgeConfigure(env *Env, opts bridgeConfigureOptions) error {
return err
}
- err = b.Configure(opts.params)
+ err = b.Configure(opts.params, !opts.nonInteractive)
if err != nil {
return err
}
diff --git a/commands/comment_add.go b/commands/comment_add.go
index 438e983a..54c75702 100644
--- a/commands/comment_add.go
+++ b/commands/comment_add.go
@@ -9,8 +9,9 @@ import (
)
type commentAddOptions struct {
- messageFile string
- message string
+ messageFile string
+ message string
+ nonInteractive bool
}
func newCommentAddCommand() *cobra.Command {
@@ -35,6 +36,7 @@ func newCommentAddCommand() *cobra.Command {
flags.StringVarP(&options.message, "message", "m", "",
"Provide the new message from the command line")
+ flags.BoolVar(&options.nonInteractive, "non-interactive", false, "Do not ask for user input")
return cmd
}
@@ -53,6 +55,10 @@ func runCommentAdd(env *Env, opts commentAddOptions, args []string) error {
}
if opts.messageFile == "" && opts.message == "" {
+ if opts.nonInteractive {
+ env.err.Println("No message given. Use -m or -F option to specify a message. Aborting.")
+ return nil
+ }
opts.message, err = input.BugCommentEditorInput(env.backend, "")
if err == input.ErrEmptyMessage {
env.err.Println("Empty message, aborting.")
diff --git a/commands/comment_edit.go b/commands/comment_edit.go
index 6a86f37e..6c93ed8b 100644
--- a/commands/comment_edit.go
+++ b/commands/comment_edit.go
@@ -7,8 +7,9 @@ import (
)
type commentEditOptions struct {
- messageFile string
- message string
+ messageFile string
+ message string
+ nonInteractive bool
}
func newCommentEditCommand() *cobra.Command {
@@ -34,6 +35,7 @@ func newCommentEditCommand() *cobra.Command {
flags.StringVarP(&options.message, "message", "m", "",
"Provide the new message from the command line")
+ flags.BoolVar(&options.nonInteractive, "non-interactive", false, "Do not ask for user input")
return cmd
}
@@ -52,6 +54,10 @@ func runCommentEdit(env *Env, opts commentEditOptions, args []string) error {
}
if opts.messageFile == "" && opts.message == "" {
+ if opts.nonInteractive {
+ env.err.Println("No message given. Use -m or -F option to specify a message. Aborting.")
+ return nil
+ }
opts.message, err = input.BugCommentEditorInput(env.backend, "")
if err == input.ErrEmptyMessage {
env.err.Println("Empty message, aborting.")
diff --git a/commands/title_edit.go b/commands/title_edit.go
index 455c9384..09415e49 100644
--- a/commands/title_edit.go
+++ b/commands/title_edit.go
@@ -9,7 +9,8 @@ import (
)
type titleEditOptions struct {
- title string
+ title string
+ nonInteractive bool
}
func newTitleEditCommand() *cobra.Command {
@@ -32,6 +33,7 @@ func newTitleEditCommand() *cobra.Command {
flags.StringVarP(&options.title, "title", "t", "",
"Provide a title to describe the issue",
)
+ flags.BoolVar(&options.nonInteractive, "non-interactive", false, "Do not ask for user input")
return cmd
}
@@ -45,6 +47,10 @@ func runTitleEdit(env *Env, opts titleEditOptions, args []string) error {
snap := b.Snapshot()
if opts.title == "" {
+ if opts.nonInteractive {
+ env.err.Println("No title given. Use -m or -F option to specify a title. Aborting.")
+ return nil
+ }
opts.title, err = input.BugTitleEditorInput(env.repo, snap.Title)
if err == input.ErrEmptyTitle {
env.out.Println("Empty title, aborting.")
diff --git a/commands/user_create.go b/commands/user_create.go
index 06879f2e..0dcfa9b3 100644
--- a/commands/user_create.go
+++ b/commands/user_create.go
@@ -7,9 +7,10 @@ import (
)
type createUserOptions struct {
- name string
- email string
- avatarURL string
+ name string
+ email string
+ avatarURL string
+ nonInteractive bool
}
func newUserCreateCommand() *cobra.Command {
@@ -30,13 +31,14 @@ func newUserCreateCommand() *cobra.Command {
flags.StringVarP(&options.name, "name", "n", "", "Name to identify the user")
flags.StringVarP(&options.email, "email", "e", "", "Email of the user")
flags.StringVarP(&options.avatarURL, "avatar", "a", "", "Avatar URL")
+ flags.BoolVar(&options.nonInteractive, "non-interactive", false, "Do not ask for user input")
return cmd
}
func runUserCreate(env *Env, opts createUserOptions) error {
- if opts.name == "" {
+ if !opts.nonInteractive && opts.name == "" {
preName, err := env.backend.GetUserName()
if err != nil {
return err
@@ -47,7 +49,7 @@ func runUserCreate(env *Env, opts createUserOptions) error {
}
}
- if opts.email == "" {
+ if !opts.nonInteractive && opts.email == "" {
preEmail, err := env.backend.GetUserEmail()
if err != nil {
return err
@@ -59,7 +61,7 @@ func runUserCreate(env *Env, opts createUserOptions) error {
}
}
- if opts.avatarURL == "" {
+ if !opts.nonInteractive && opts.avatarURL == "" {
var err error
opts.avatarURL, err = input.Prompt("Avatar URL", "avatar")
if err != nil {
diff --git a/doc/man/git-bug-add.1 b/doc/man/git-bug-add.1
index f5083119..e9e85cfa 100644
--- a/doc/man/git-bug-add.1
+++ b/doc/man/git-bug-add.1
@@ -30,6 +30,10 @@ Create a new bug.
Take the message from the given file. Use \- to read the message from the standard input
.PP
+\fB\-\-non\-interactive\fP[=false]
+ Do not ask for user input
+
+.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
help for add
diff --git a/doc/man/git-bug-bridge-configure.1 b/doc/man/git-bug-bridge-configure.1
index 3ce411a9..4e3da371 100644
--- a/doc/man/git-bug-bridge-configure.1
+++ b/doc/man/git-bug-bridge-configure.1
@@ -64,6 +64,10 @@ Configure a new bridge by passing flags or/and using interactive terminal prompt
The name of the remote repository
.PP
+\fB\-\-non\-interactive\fP[=false]
+ Do not ask for user input
+
+.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
help for configure
diff --git a/doc/man/git-bug-comment-add.1 b/doc/man/git-bug-comment-add.1
index d1845782..c33ac22d 100644
--- a/doc/man/git-bug-comment-add.1
+++ b/doc/man/git-bug-comment-add.1
@@ -26,6 +26,10 @@ Add a new comment to a bug.
Provide the new message from the command line
.PP
+\fB\-\-non\-interactive\fP[=false]
+ Do not ask for user input
+
+.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
help for add
diff --git a/doc/man/git-bug-comment-edit.1 b/doc/man/git-bug-comment-edit.1
index 741743a6..c476b47a 100644
--- a/doc/man/git-bug-comment-edit.1
+++ b/doc/man/git-bug-comment-edit.1
@@ -26,6 +26,10 @@ Edit an existing comment on a bug.
Provide the new message from the command line
.PP
+\fB\-\-non\-interactive\fP[=false]
+ Do not ask for user input
+
+.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
help for edit
diff --git a/doc/man/git-bug-title-edit.1 b/doc/man/git-bug-title-edit.1
index ea378d42..2164d71a 100644
--- a/doc/man/git-bug-title-edit.1
+++ b/doc/man/git-bug-title-edit.1
@@ -22,6 +22,10 @@ Edit a title of a bug.
Provide a title to describe the issue
.PP
+\fB\-\-non\-interactive\fP[=false]
+ Do not ask for user input
+
+.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
help for edit
diff --git a/doc/man/git-bug-user-create.1 b/doc/man/git-bug-user-create.1
index 181cd15f..f547ebd7 100644
--- a/doc/man/git-bug-user-create.1
+++ b/doc/man/git-bug-user-create.1
@@ -33,6 +33,10 @@ Create a new identity.
\fB\-n\fP, \fB\-\-name\fP=""
Name to identify the user
+.PP
+\fB\-\-non\-interactive\fP[=false]
+ Do not ask for user input
+
.SH SEE ALSO
.PP
diff --git a/doc/md/git-bug_add.md b/doc/md/git-bug_add.md
index 4e76ca7c..5e748610 100644
--- a/doc/md/git-bug_add.md
+++ b/doc/md/git-bug_add.md
@@ -9,10 +9,11 @@ git-bug add [flags]
### Options
```
- -t, --title string Provide a title to describe the issue
- -m, --message string Provide a message to describe the issue
- -F, --file string Take the message from the given file. Use - to read the message from the standard input
- -h, --help help for add
+ -t, --title string Provide a title to describe the issue
+ -m, --message string Provide a message to describe the issue
+ -F, --file string Take the message from the given file. Use - to read the message from the standard input
+ --non-interactive Do not ask for user input
+ -h, --help help for add
```
### SEE ALSO
diff --git a/doc/md/git-bug_bridge_configure.md b/doc/md/git-bug_bridge_configure.md
index f89de404..f71e294d 100644
--- a/doc/md/git-bug_bridge_configure.md
+++ b/doc/md/git-bug_bridge_configure.md
@@ -81,6 +81,7 @@ git bug bridge configure \
--token-stdin Will read the token from stdin and ignore --token
-o, --owner string The owner of the remote repository
-p, --project string The name of the remote repository
+ --non-interactive Do not ask for user input
-h, --help help for configure
```
diff --git a/doc/md/git-bug_comment_add.md b/doc/md/git-bug_comment_add.md
index 83133949..5a199aba 100644
--- a/doc/md/git-bug_comment_add.md
+++ b/doc/md/git-bug_comment_add.md
@@ -9,9 +9,10 @@ git-bug comment add [ID] [flags]
### Options
```
- -F, --file string Take the message from the given file. Use - to read the message from the standard input
- -m, --message string Provide the new message from the command line
- -h, --help help for add
+ -F, --file string Take the message from the given file. Use - to read the message from the standard input
+ -m, --message string Provide the new message from the command line
+ --non-interactive Do not ask for user input
+ -h, --help help for add
```
### SEE ALSO
diff --git a/doc/md/git-bug_comment_edit.md b/doc/md/git-bug_comment_edit.md
index 26571927..1a53b439 100644
--- a/doc/md/git-bug_comment_edit.md
+++ b/doc/md/git-bug_comment_edit.md
@@ -9,9 +9,10 @@ git-bug comment edit [COMMENT_ID] [flags]
### Options
```
- -F, --file string Take the message from the given file. Use - to read the message from the standard input
- -m, --message string Provide the new message from the command line
- -h, --help help for edit
+ -F, --file string Take the message from the given file. Use - to read the message from the standard input
+ -m, --message string Provide the new message from the command line
+ --non-interactive Do not ask for user input
+ -h, --help help for edit
```
### SEE ALSO
diff --git a/doc/md/git-bug_title_edit.md b/doc/md/git-bug_title_edit.md
index 61a4e4bd..ae060680 100644
--- a/doc/md/git-bug_title_edit.md
+++ b/doc/md/git-bug_title_edit.md
@@ -9,8 +9,9 @@ git-bug title edit [ID] [flags]
### Options
```
- -t, --title string Provide a title to describe the issue
- -h, --help help for edit
+ -t, --title string Provide a title to describe the issue
+ --non-interactive Do not ask for user input
+ -h, --help help for edit
```
### SEE ALSO
diff --git a/doc/md/git-bug_user_create.md b/doc/md/git-bug_user_create.md
index 25811322..68fc2c0e 100644
--- a/doc/md/git-bug_user_create.md
+++ b/doc/md/git-bug_user_create.md
@@ -9,10 +9,11 @@ git-bug user create [flags]
### Options
```
- -a, --avatar string Avatar URL
- -e, --email string Email of the user
- -h, --help help for create
- -n, --name string Name to identify the user
+ -a, --avatar string Avatar URL
+ -e, --email string Email of the user
+ -h, --help help for create
+ -n, --name string Name to identify the user
+ --non-interactive Do not ask for user input
```
### SEE ALSO
diff --git a/misc/bash_completion/git-bug b/misc/bash_completion/git-bug
index bdca026f..8b303991 100644
--- a/misc/bash_completion/git-bug
+++ b/misc/bash_completion/git-bug
@@ -390,6 +390,8 @@ _git-bug_add()
local_nonpersistent_flags+=("--file")
local_nonpersistent_flags+=("--file=")
local_nonpersistent_flags+=("-F")
+ flags+=("--non-interactive")
+ local_nonpersistent_flags+=("--non-interactive")
must_have_one_flag=()
must_have_one_noun=()
@@ -565,6 +567,8 @@ _git-bug_bridge_configure()
local_nonpersistent_flags+=("--project")
local_nonpersistent_flags+=("--project=")
local_nonpersistent_flags+=("-p")
+ flags+=("--non-interactive")
+ local_nonpersistent_flags+=("--non-interactive")
must_have_one_flag=()
must_have_one_noun=()
@@ -716,6 +720,8 @@ _git-bug_comment_add()
local_nonpersistent_flags+=("--message")
local_nonpersistent_flags+=("--message=")
local_nonpersistent_flags+=("-m")
+ flags+=("--non-interactive")
+ local_nonpersistent_flags+=("--non-interactive")
must_have_one_flag=()
must_have_one_noun=()
@@ -748,6 +754,8 @@ _git-bug_comment_edit()
local_nonpersistent_flags+=("--message")
local_nonpersistent_flags+=("--message=")
local_nonpersistent_flags+=("-m")
+ flags+=("--non-interactive")
+ local_nonpersistent_flags+=("--non-interactive")
must_have_one_flag=()
must_have_one_noun=()
@@ -1196,6 +1204,8 @@ _git-bug_title_edit()
local_nonpersistent_flags+=("--title")
local_nonpersistent_flags+=("--title=")
local_nonpersistent_flags+=("-t")
+ flags+=("--non-interactive")
+ local_nonpersistent_flags+=("--non-interactive")
must_have_one_flag=()
must_have_one_noun=()
@@ -1275,6 +1285,8 @@ _git-bug_user_create()
local_nonpersistent_flags+=("--name")
local_nonpersistent_flags+=("--name=")
local_nonpersistent_flags+=("-n")
+ flags+=("--non-interactive")
+ local_nonpersistent_flags+=("--non-interactive")
must_have_one_flag=()
must_have_one_noun=()
diff --git a/webui/src/components/Header/Header.tsx b/webui/src/components/Header/Header.tsx
index 56b35968..866e52db 100644
--- a/webui/src/components/Header/Header.tsx
+++ b/webui/src/components/Header/Header.tsx
@@ -6,7 +6,7 @@ import Tab, { TabProps } from '@material-ui/core/Tab';
import Tabs from '@material-ui/core/Tabs';
import Toolbar from '@material-ui/core/Toolbar';
import Tooltip from '@material-ui/core/Tooltip/Tooltip';
-import { makeStyles } from '@material-ui/core/styles';
+import { fade, makeStyles } from '@material-ui/core/styles';
import CurrentIdentity from '../Identity/CurrentIdentity';
import { LightSwitch } from '../Themer';
@@ -30,7 +30,8 @@ const useStyles = makeStyles((theme) => ({
alignItems: 'center',
},
lightSwitch: {
- padding: '0 20px',
+ marginRight: '20px',
+ color: fade(theme.palette.primary.contrastText, 0.5),
},
logo: {
height: '42px',
@@ -85,9 +86,7 @@ function Header() {
git-bug
</Link>
<div className={classes.filler} />
- <div className={classes.lightSwitch}>
- <LightSwitch />
- </div>
+ <LightSwitch className={classes.lightSwitch} />
<CurrentIdentity />
</Toolbar>
</AppBar>
diff --git a/webui/src/components/Themer.tsx b/webui/src/components/Themer.tsx
index b4877974..edf1f352 100644
--- a/webui/src/components/Themer.tsx
+++ b/webui/src/components/Themer.tsx
@@ -1,35 +1,30 @@
import React, { createContext, useContext, useState } from 'react';
-import { fade, ThemeProvider } from '@material-ui/core';
-import IconButton from '@material-ui/core/IconButton/IconButton';
-import Tooltip from '@material-ui/core/Tooltip/Tooltip';
+import { ThemeProvider } from '@material-ui/core';
+import IconButton from '@material-ui/core/IconButton';
+import Tooltip from '@material-ui/core/Tooltip';
import { Theme } from '@material-ui/core/styles';
import { NightsStayRounded, WbSunnyRounded } from '@material-ui/icons';
-import { makeStyles } from '@material-ui/styles';
const ThemeContext = createContext({
toggleMode: () => {},
mode: '',
});
-const useStyles = makeStyles((theme: Theme) => ({
- iconButton: {
- color: fade(theme.palette.primary.contrastText, 0.5),
- },
-}));
-
-const LightSwitch = () => {
+type LightSwitchProps = {
+ className?: string;
+};
+const LightSwitch = ({ className }: LightSwitchProps) => {
const { mode, toggleMode } = useContext(ThemeContext);
const nextMode = mode === 'light' ? 'dark' : 'light';
const description = `Switch to ${nextMode} theme`;
- const classes = useStyles();
return (
<Tooltip title={description}>
<IconButton
onClick={toggleMode}
aria-label={description}
- className={classes.iconButton}
+ className={className}
>
{mode === 'light' ? <WbSunnyRounded /> : <NightsStayRounded />}
</IconButton>