Remove webmode

This commit is contained in:
Sam Coe 2021-02-08 09:17:04 -08:00
parent b366802aa1
commit 68f71d82a0
No known key found for this signature in database
GPG key ID: 8E322C20F811D086
2 changed files with 1 additions and 34 deletions

View file

@ -30,7 +30,6 @@ type EditOptions struct {
SelectorArg string
Interactive bool
WebMode bool
prShared.EditableOptions
}
@ -89,7 +88,7 @@ func NewCmdEdit(f *cmdutil.Factory, runF func(*EditOptions) error) *cobra.Comman
}
if opts.Interactive && !opts.IO.CanPrompt() {
return &cmdutil.FlagError{Err: errors.New("--tile, --body, --assignee, --label, --project, --milestone, or --web required when not running interactively")}
return &cmdutil.FlagError{Err: errors.New("--tile, --body, --assignee, --label, --project, or --milestone required when not running interactively")}
}
if runF != nil {
@ -100,7 +99,6 @@ func NewCmdEdit(f *cmdutil.Factory, runF func(*EditOptions) error) *cobra.Comman
},
}
cmd.Flags().BoolVarP(&opts.WebMode, "web", "w", false, "Open the browser to create an issue")
cmd.Flags().StringVarP(&opts.EditableOptions.Title, "title", "t", "", "Supply a title. Will prompt for one otherwise.")
cmd.Flags().StringVarP(&opts.EditableOptions.Body, "body", "b", "", "Supply a body. Will prompt for one otherwise.")
cmd.Flags().StringSliceVarP(&opts.EditableOptions.Assignees, "assignee", "a", nil, "Assign people by their `login`. Use \"@me\" to self-assign.")
@ -123,14 +121,6 @@ func editRun(opts *EditOptions) error {
return err
}
if opts.WebMode {
openURL := issue.URL
if opts.IO.IsStdoutTTY() {
fmt.Fprintf(opts.IO.ErrOut, "Opening %s in your browser.\n", utils.DisplayURL(openURL))
}
return opts.OpenInBrowser(openURL)
}
editOptions := opts.EditableOptions
editOptions.TitleDefault = issue.Title
editOptions.BodyDefault = issue.Body

View file

@ -36,16 +36,6 @@ func TestNewCmdEdit(t *testing.T) {
},
wantsErr: false,
},
{
name: "web flag",
input: "23 --web",
output: EditOptions{
SelectorArg: "23",
Interactive: true,
WebMode: true,
},
wantsErr: false,
},
{
name: "title flag",
input: "23 --title test",
@ -153,7 +143,6 @@ func TestNewCmdEdit(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, tt.output.SelectorArg, gotOpts.SelectorArg)
assert.Equal(t, tt.output.WebMode, gotOpts.WebMode)
assert.Equal(t, tt.output.Interactive, gotOpts.Interactive)
assert.Equal(t, tt.output.EditableOptions, gotOpts.EditableOptions)
})
@ -168,18 +157,6 @@ func Test_editRun(t *testing.T) {
stdout string
stderr string
}{
{
name: "web mode",
input: &EditOptions{
SelectorArg: "123",
WebMode: true,
OpenInBrowser: func(string) error { return nil },
},
httpStubs: func(t *testing.T, reg *httpmock.Registry) {
mockIssueGet(t, reg)
},
stderr: "Opening github.com/OWNER/REPO/issue/123 in your browser.\n",
},
{
name: "non-interactive",
input: &EditOptions{