From 68f71d82a0f69607bb6f9e2bd3513d7f19da166c Mon Sep 17 00:00:00 2001 From: Sam Coe Date: Mon, 8 Feb 2021 09:17:04 -0800 Subject: [PATCH] Remove webmode --- pkg/cmd/issue/edit/edit.go | 12 +----------- pkg/cmd/issue/edit/edit_test.go | 23 ----------------------- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/pkg/cmd/issue/edit/edit.go b/pkg/cmd/issue/edit/edit.go index cfb0ad23e..a53e2eacb 100644 --- a/pkg/cmd/issue/edit/edit.go +++ b/pkg/cmd/issue/edit/edit.go @@ -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 diff --git a/pkg/cmd/issue/edit/edit_test.go b/pkg/cmd/issue/edit/edit_test.go index 15616d008..a5d090c51 100644 --- a/pkg/cmd/issue/edit/edit_test.go +++ b/pkg/cmd/issue/edit/edit_test.go @@ -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{