Yaml to YAML

This commit is contained in:
Sam Coe 2021-04-02 09:43:33 -07:00
parent 5566289d1c
commit d1b153c6dc
No known key found for this signature in database
GPG key ID: 8E322C20F811D086
2 changed files with 13 additions and 13 deletions

View file

@ -30,7 +30,7 @@ type ViewOptions struct {
Web bool
Prompt bool
Raw bool
Yaml bool
YAML bool
}
func NewCmdView(f *cmdutil.Factory, runF func(*ViewOptions) error) *cobra.Command {
@ -74,7 +74,7 @@ func NewCmdView(f *cmdutil.Factory, runF func(*ViewOptions) error) *cobra.Comman
}
cmd.Flags().BoolVarP(&opts.Web, "web", "w", false, "Open workflow in the browser")
cmd.Flags().BoolVarP(&opts.Yaml, "yaml", "y", false, "View the workflow yaml file")
cmd.Flags().BoolVarP(&opts.YAML, "yaml", "y", false, "View the workflow yaml file")
cmd.Flags().StringVarP(&opts.Ref, "ref", "r", "", "The branch or tag name which contains the version of the workflow file you'd like to view")
return cmd
@ -102,7 +102,7 @@ func runView(opts *ViewOptions) error {
if opts.Web {
var url string
hostname := repo.RepoHost()
if opts.Yaml {
if opts.YAML {
ref := opts.Ref
if ref == "" {
opts.IO.StartProgressIndicator()
@ -123,7 +123,7 @@ func runView(opts *ViewOptions) error {
return opts.Browser.Browse(url)
}
if opts.Yaml {
if opts.YAML {
err = viewWorkflowContent(opts, client, workflow)
} else {
err = viewWorkflowInfo(opts, client, workflow)

View file

@ -77,7 +77,7 @@ func TestNewCmdView(t *testing.T) {
tty: true,
wants: ViewOptions{
Prompt: true,
Yaml: true,
YAML: true,
},
},
{
@ -85,7 +85,7 @@ func TestNewCmdView(t *testing.T) {
cli: "-y 123",
wants: ViewOptions{
Raw: true,
Yaml: true,
YAML: true,
Selector: "123",
},
},
@ -144,7 +144,7 @@ func TestNewCmdView(t *testing.T) {
assert.Equal(t, tt.wants.Web, gotOpts.Web)
assert.Equal(t, tt.wants.Prompt, gotOpts.Prompt)
assert.Equal(t, tt.wants.Raw, gotOpts.Raw)
assert.Equal(t, tt.wants.Yaml, gotOpts.Yaml)
assert.Equal(t, tt.wants.YAML, gotOpts.YAML)
})
}
}
@ -231,7 +231,7 @@ func TestViewRun(t *testing.T) {
tty: true,
opts: &ViewOptions{
Selector: "123",
Yaml: true,
YAML: true,
Web: true,
},
httpStubs: func(reg *httpmock.Registry) {
@ -252,7 +252,7 @@ func TestViewRun(t *testing.T) {
opts: &ViewOptions{
Selector: "123",
Ref: "base",
Yaml: true,
YAML: true,
Web: true,
},
httpStubs: func(reg *httpmock.Registry) {
@ -268,7 +268,7 @@ func TestViewRun(t *testing.T) {
tty: true,
opts: &ViewOptions{
Selector: "123",
Yaml: true,
YAML: true,
},
httpStubs: func(reg *httpmock.Registry) {
reg.Register(
@ -287,7 +287,7 @@ func TestViewRun(t *testing.T) {
tty: false,
opts: &ViewOptions{
Selector: "123",
Yaml: true,
YAML: true,
},
httpStubs: func(reg *httpmock.Registry) {
reg.Register(
@ -306,7 +306,7 @@ func TestViewRun(t *testing.T) {
tty: true,
opts: &ViewOptions{
Selector: "123",
Yaml: true,
YAML: true,
},
httpStubs: func(reg *httpmock.Registry) {
reg.Register(
@ -327,7 +327,7 @@ func TestViewRun(t *testing.T) {
opts: &ViewOptions{
Selector: "123",
Ref: "456",
Yaml: true,
YAML: true,
},
httpStubs: func(reg *httpmock.Registry) {
reg.Register(