diff --git a/CHANGELOG.md b/CHANGELOG.md index 8633eb18a..bdd48d50a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - refactor(argparser/flags.go): add flag conversion utilities for converting string flags to bools and checking ascending and desecnding flags ([#1611](https://github.com/fastly/cli/pull/1611)) - feat(service/purge): Add 'service purge' command as replacement for 'purge', with an unlisted and deprecated alias of 'purge'. ([#1612](https://github.com/fastly/cli/pull/1612)) - feat(service/version): Add 'service version ...' commands as replacements for 'service-version ...', with unlisted and deprecated aliases of 'service-version ...'. ([#1614](https://github.com/fastly/cli/pull/1614)) +- feat(vcl): moved the `vcl` command under the `service` command, with an unlisted and deprecated alias of `vcl` ([#1616](https://github.com/fastly/cli/pull/1616)) ### Bug fixes: diff --git a/pkg/app/run_test.go b/pkg/app/run_test.go index 29afccc86..ac7ad2d34 100644 --- a/pkg/app/run_test.go +++ b/pkg/app/run_test.go @@ -100,7 +100,6 @@ tls-subscription tools update user -vcl version whoami `, diff --git a/pkg/commands/alias/vcl/condition/create.go b/pkg/commands/alias/vcl/condition/create.go new file mode 100644 index 000000000..c98be81cb --- /dev/null +++ b/pkg/commands/alias/vcl/condition/create.go @@ -0,0 +1,29 @@ +package condition + +import ( + "io" + + newcmd "github.com/fastly/cli/pkg/commands/service/vcl/condition" + + "github.com/fastly/cli/pkg/argparser" + "github.com/fastly/cli/pkg/global" + "github.com/fastly/cli/pkg/text" +) + +// CreateCommand wraps the CreateCommand from the newcmd package. +type CreateCommand struct { + *newcmd.CreateCommand +} + +// NewCreateCommand returns a usable command registered under the parent. +func NewCreateCommand(parent argparser.Registerer, g *global.Data) *CreateCommand { + c := CreateCommand{newcmd.NewCreateCommand(parent, g)} + c.CmdClause.Hidden() + return &c +} + +// Exec implements the command interface. +func (c *CreateCommand) Exec(in io.Reader, out io.Writer) error { + text.Deprecated(out, "Use the 'service vcl condition create' command instead.") + return c.CreateCommand.Exec(in, out) +} diff --git a/pkg/commands/alias/vcl/condition/delete.go b/pkg/commands/alias/vcl/condition/delete.go new file mode 100644 index 000000000..c5f822888 --- /dev/null +++ b/pkg/commands/alias/vcl/condition/delete.go @@ -0,0 +1,29 @@ +package condition + +import ( + "io" + + newcmd "github.com/fastly/cli/pkg/commands/service/vcl/condition" + + "github.com/fastly/cli/pkg/argparser" + "github.com/fastly/cli/pkg/global" + "github.com/fastly/cli/pkg/text" +) + +// DeleteCommand wraps the DeleteCommand from the newcmd package. +type DeleteCommand struct { + *newcmd.DeleteCommand +} + +// NewDeleteCommand returns a usable command registered under the parent. +func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteCommand { + c := DeleteCommand{newcmd.NewDeleteCommand(parent, g)} + c.CmdClause.Hidden() + return &c +} + +// Exec implements the command interface. +func (c *DeleteCommand) Exec(in io.Reader, out io.Writer) error { + text.Deprecated(out, "Use the 'service vcl condition delete' command instead.") + return c.DeleteCommand.Exec(in, out) +} diff --git a/pkg/commands/alias/vcl/condition/describe.go b/pkg/commands/alias/vcl/condition/describe.go new file mode 100644 index 000000000..0e8f24efa --- /dev/null +++ b/pkg/commands/alias/vcl/condition/describe.go @@ -0,0 +1,29 @@ +package condition + +import ( + "io" + + newcmd "github.com/fastly/cli/pkg/commands/service/vcl/condition" + + "github.com/fastly/cli/pkg/argparser" + "github.com/fastly/cli/pkg/global" + "github.com/fastly/cli/pkg/text" +) + +// DescribeCommand wraps the DescribeCommand from the newcmd package. +type DescribeCommand struct { + *newcmd.DescribeCommand +} + +// NewDescribeCommand returns a usable command registered under the parent. +func NewDescribeCommand(parent argparser.Registerer, g *global.Data) *DescribeCommand { + c := DescribeCommand{newcmd.NewDescribeCommand(parent, g)} + c.CmdClause.Hidden() + return &c +} + +// Exec implements the command interface. +func (c *DescribeCommand) Exec(in io.Reader, out io.Writer) error { + text.Deprecated(out, "Use the 'service vcl condition describe' command instead.") + return c.DescribeCommand.Exec(in, out) +} diff --git a/pkg/commands/alias/vcl/condition/doc.go b/pkg/commands/alias/vcl/condition/doc.go new file mode 100644 index 000000000..675a2edd8 --- /dev/null +++ b/pkg/commands/alias/vcl/condition/doc.go @@ -0,0 +1,2 @@ +// Package condition contains deprecated aliases for the 'service vcl' condition commands. +package condition diff --git a/pkg/commands/alias/vcl/condition/list.go b/pkg/commands/alias/vcl/condition/list.go new file mode 100644 index 000000000..8010cb6f3 --- /dev/null +++ b/pkg/commands/alias/vcl/condition/list.go @@ -0,0 +1,31 @@ +package condition + +import ( + "io" + + newcmd "github.com/fastly/cli/pkg/commands/service/vcl/condition" + + "github.com/fastly/cli/pkg/argparser" + "github.com/fastly/cli/pkg/global" + "github.com/fastly/cli/pkg/text" +) + +// ListCommand wraps the ListCommand from the newcmd package. +type ListCommand struct { + *newcmd.ListCommand +} + +// NewListCommand returns a usable command registered under the parent. +func NewListCommand(parent argparser.Registerer, g *global.Data) *ListCommand { + c := ListCommand{newcmd.NewListCommand(parent, g)} + c.CmdClause.Hidden() + return &c +} + +// Exec implements the command interface. +func (c *ListCommand) Exec(in io.Reader, out io.Writer) error { + if !c.JSONOutput.Enabled { + text.Deprecated(out, "Use the 'service vcl condition list' command instead.") + } + return c.ListCommand.Exec(in, out) +} diff --git a/pkg/commands/alias/vcl/condition/root.go b/pkg/commands/alias/vcl/condition/root.go new file mode 100644 index 000000000..e9b3252d7 --- /dev/null +++ b/pkg/commands/alias/vcl/condition/root.go @@ -0,0 +1,31 @@ +package condition + +import ( + "io" + + "github.com/fastly/cli/pkg/argparser" + "github.com/fastly/cli/pkg/global" +) + +// RootCommand is the parent command for all subcommands in this package. +// It should be installed under the primary root command. +type RootCommand struct { + argparser.Base + // no flags +} + +// CommandName is the string to be used to invoke this command. +const CommandName = "condition" + +// NewRootCommand returns a new command registered in the parent. +func NewRootCommand(parent argparser.Registerer, g *global.Data) *RootCommand { + var c RootCommand + c.Globals = g + c.CmdClause = parent.Command(CommandName, "Manipulate Fastly VCL conditions").Hidden() + return &c +} + +// Exec implements the command interface. +func (c *RootCommand) Exec(_ io.Reader, _ io.Writer) error { + panic("unreachable") +} diff --git a/pkg/commands/alias/vcl/condition/update.go b/pkg/commands/alias/vcl/condition/update.go new file mode 100644 index 000000000..8fd450e2f --- /dev/null +++ b/pkg/commands/alias/vcl/condition/update.go @@ -0,0 +1,29 @@ +package condition + +import ( + "io" + + newcmd "github.com/fastly/cli/pkg/commands/service/vcl/condition" + + "github.com/fastly/cli/pkg/argparser" + "github.com/fastly/cli/pkg/global" + "github.com/fastly/cli/pkg/text" +) + +// UpdateCommand wraps the UpdateCommand from the newcmd package. +type UpdateCommand struct { + *newcmd.UpdateCommand +} + +// NewUpdateCommand returns a usable command registered under the parent. +func NewUpdateCommand(parent argparser.Registerer, g *global.Data) *UpdateCommand { + c := UpdateCommand{newcmd.NewUpdateCommand(parent, g)} + c.CmdClause.Hidden() + return &c +} + +// Exec implements the command interface. +func (c *UpdateCommand) Exec(in io.Reader, out io.Writer) error { + text.Deprecated(out, "Use the 'service vcl condition update' command instead.") + return c.UpdateCommand.Exec(in, out) +} diff --git a/pkg/commands/alias/vcl/custom/create.go b/pkg/commands/alias/vcl/custom/create.go new file mode 100644 index 000000000..5a7f8b0a4 --- /dev/null +++ b/pkg/commands/alias/vcl/custom/create.go @@ -0,0 +1,29 @@ +package custom + +import ( + "io" + + newcmd "github.com/fastly/cli/pkg/commands/service/vcl/custom" + + "github.com/fastly/cli/pkg/argparser" + "github.com/fastly/cli/pkg/global" + "github.com/fastly/cli/pkg/text" +) + +// CreateCommand wraps the CreateCommand from the newcmd package. +type CreateCommand struct { + *newcmd.CreateCommand +} + +// NewCreateCommand returns a usable command registered under the parent. +func NewCreateCommand(parent argparser.Registerer, g *global.Data) *CreateCommand { + c := CreateCommand{newcmd.NewCreateCommand(parent, g)} + c.CmdClause.Hidden() + return &c +} + +// Exec implements the command interface. +func (c *CreateCommand) Exec(in io.Reader, out io.Writer) error { + text.Deprecated(out, "Use the 'service vcl custom create' command instead.") + return c.CreateCommand.Exec(in, out) +} diff --git a/pkg/commands/alias/vcl/custom/delete.go b/pkg/commands/alias/vcl/custom/delete.go new file mode 100644 index 000000000..01b077592 --- /dev/null +++ b/pkg/commands/alias/vcl/custom/delete.go @@ -0,0 +1,29 @@ +package custom + +import ( + "io" + + newcmd "github.com/fastly/cli/pkg/commands/service/vcl/custom" + + "github.com/fastly/cli/pkg/argparser" + "github.com/fastly/cli/pkg/global" + "github.com/fastly/cli/pkg/text" +) + +// DeleteCommand wraps the DeleteCommand from the newcmd package. +type DeleteCommand struct { + *newcmd.DeleteCommand +} + +// NewDeleteCommand returns a usable command registered under the parent. +func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteCommand { + c := DeleteCommand{newcmd.NewDeleteCommand(parent, g)} + c.CmdClause.Hidden() + return &c +} + +// Exec implements the command interface. +func (c *DeleteCommand) Exec(in io.Reader, out io.Writer) error { + text.Deprecated(out, "Use the 'service vcl custom delete' command instead.") + return c.DeleteCommand.Exec(in, out) +} diff --git a/pkg/commands/alias/vcl/custom/describe.go b/pkg/commands/alias/vcl/custom/describe.go new file mode 100644 index 000000000..79c010b73 --- /dev/null +++ b/pkg/commands/alias/vcl/custom/describe.go @@ -0,0 +1,29 @@ +package custom + +import ( + "io" + + newcmd "github.com/fastly/cli/pkg/commands/service/vcl/custom" + + "github.com/fastly/cli/pkg/argparser" + "github.com/fastly/cli/pkg/global" + "github.com/fastly/cli/pkg/text" +) + +// DescribeCommand wraps the DescribeCommand from the newcmd package. +type DescribeCommand struct { + *newcmd.DescribeCommand +} + +// NewDescribeCommand returns a usable command registered under the parent. +func NewDescribeCommand(parent argparser.Registerer, g *global.Data) *DescribeCommand { + c := DescribeCommand{newcmd.NewDescribeCommand(parent, g)} + c.CmdClause.Hidden() + return &c +} + +// Exec implements the command interface. +func (c *DescribeCommand) Exec(in io.Reader, out io.Writer) error { + text.Deprecated(out, "Use the 'service vcl custom describe' command instead.") + return c.DescribeCommand.Exec(in, out) +} diff --git a/pkg/commands/alias/vcl/custom/doc.go b/pkg/commands/alias/vcl/custom/doc.go new file mode 100644 index 000000000..503bcd272 --- /dev/null +++ b/pkg/commands/alias/vcl/custom/doc.go @@ -0,0 +1,2 @@ +// Package custom contains deprecated aliases for the 'service vcl' custom commands. +package custom diff --git a/pkg/commands/alias/vcl/custom/list.go b/pkg/commands/alias/vcl/custom/list.go new file mode 100644 index 000000000..7868d7a02 --- /dev/null +++ b/pkg/commands/alias/vcl/custom/list.go @@ -0,0 +1,31 @@ +package custom + +import ( + "io" + + newcmd "github.com/fastly/cli/pkg/commands/service/vcl/custom" + + "github.com/fastly/cli/pkg/argparser" + "github.com/fastly/cli/pkg/global" + "github.com/fastly/cli/pkg/text" +) + +// ListCommand wraps the ListCommand from the newcmd package. +type ListCommand struct { + *newcmd.ListCommand +} + +// NewListCommand returns a usable command registered under the parent. +func NewListCommand(parent argparser.Registerer, g *global.Data) *ListCommand { + c := ListCommand{newcmd.NewListCommand(parent, g)} + c.CmdClause.Hidden() + return &c +} + +// Exec implements the command interface. +func (c *ListCommand) Exec(in io.Reader, out io.Writer) error { + if !c.JSONOutput.Enabled { + text.Deprecated(out, "Use the 'service vcl custom list' command instead.") + } + return c.ListCommand.Exec(in, out) +} diff --git a/pkg/commands/alias/vcl/custom/root.go b/pkg/commands/alias/vcl/custom/root.go new file mode 100644 index 000000000..cd01dd8f8 --- /dev/null +++ b/pkg/commands/alias/vcl/custom/root.go @@ -0,0 +1,31 @@ +package custom + +import ( + "io" + + "github.com/fastly/cli/pkg/argparser" + "github.com/fastly/cli/pkg/global" +) + +// RootCommand is the parent command for all subcommands in this package. +// It should be installed under the primary root command. +type RootCommand struct { + argparser.Base + // no flags +} + +// CommandName is the string to be used to invoke this command. +const CommandName = "custom" + +// NewRootCommand returns a new command registered in the parent. +func NewRootCommand(parent argparser.Registerer, g *global.Data) *RootCommand { + var c RootCommand + c.Globals = g + c.CmdClause = parent.Command(CommandName, "Manipulate Fastly custom VCL files").Hidden() + return &c +} + +// Exec implements the command interface. +func (c *RootCommand) Exec(_ io.Reader, _ io.Writer) error { + panic("unreachable") +} diff --git a/pkg/commands/alias/vcl/custom/update.go b/pkg/commands/alias/vcl/custom/update.go new file mode 100644 index 000000000..4745cc0d8 --- /dev/null +++ b/pkg/commands/alias/vcl/custom/update.go @@ -0,0 +1,29 @@ +package custom + +import ( + "io" + + newcmd "github.com/fastly/cli/pkg/commands/service/vcl/custom" + + "github.com/fastly/cli/pkg/argparser" + "github.com/fastly/cli/pkg/global" + "github.com/fastly/cli/pkg/text" +) + +// UpdateCommand wraps the UpdateCommand from the newcmd package. +type UpdateCommand struct { + *newcmd.UpdateCommand +} + +// NewUpdateCommand returns a usable command registered under the parent. +func NewUpdateCommand(parent argparser.Registerer, g *global.Data) *UpdateCommand { + c := UpdateCommand{newcmd.NewUpdateCommand(parent, g)} + c.CmdClause.Hidden() + return &c +} + +// Exec implements the command interface. +func (c *UpdateCommand) Exec(in io.Reader, out io.Writer) error { + text.Deprecated(out, "Use the 'service vcl custom update' command instead.") + return c.UpdateCommand.Exec(in, out) +} diff --git a/pkg/commands/alias/vcl/describe.go b/pkg/commands/alias/vcl/describe.go new file mode 100644 index 000000000..5a570dcd0 --- /dev/null +++ b/pkg/commands/alias/vcl/describe.go @@ -0,0 +1,29 @@ +package vcl + +import ( + "io" + + newcmd "github.com/fastly/cli/pkg/commands/service/vcl" + + "github.com/fastly/cli/pkg/argparser" + "github.com/fastly/cli/pkg/global" + "github.com/fastly/cli/pkg/text" +) + +// DescribeCommand wraps the DescribeCommand from the newcmd package. +type DescribeCommand struct { + *newcmd.DescribeCommand +} + +// NewDescribeCommand returns a usable command registered under the parent. +func NewDescribeCommand(parent argparser.Registerer, g *global.Data) *DescribeCommand { + c := DescribeCommand{newcmd.NewDescribeCommand(parent, g)} + c.CmdClause.Hidden() + return &c +} + +// Exec implements the command interface. +func (c *DescribeCommand) Exec(in io.Reader, out io.Writer) error { + text.Deprecated(out, "Use the 'service vcl describe' command instead.") + return c.DescribeCommand.Exec(in, out) +} diff --git a/pkg/commands/alias/vcl/doc.go b/pkg/commands/alias/vcl/doc.go new file mode 100644 index 000000000..628c1bb2e --- /dev/null +++ b/pkg/commands/alias/vcl/doc.go @@ -0,0 +1,2 @@ +// Package vcl contains deprecated aliases for the 'service vcl' commands. +package vcl diff --git a/pkg/commands/alias/vcl/root.go b/pkg/commands/alias/vcl/root.go new file mode 100644 index 000000000..bc4e3d148 --- /dev/null +++ b/pkg/commands/alias/vcl/root.go @@ -0,0 +1,31 @@ +package vcl + +import ( + "io" + + "github.com/fastly/cli/pkg/argparser" + "github.com/fastly/cli/pkg/global" +) + +// RootCommand is the parent command for all subcommands in this package. +// It should be installed under the primary root command. +type RootCommand struct { + argparser.Base + // no flags +} + +// CommandName is the string to be used to invoke this command. +const CommandName = "vcl" + +// NewRootCommand returns a new command registered in the parent. +func NewRootCommand(parent argparser.Registerer, g *global.Data) *RootCommand { + var c RootCommand + c.Globals = g + c.CmdClause = parent.Command(CommandName, "Manipulate Fastly service version VCL").Hidden() + return &c +} + +// Exec implements the command interface. +func (c *RootCommand) Exec(_ io.Reader, _ io.Writer) error { + panic("unreachable") +} diff --git a/pkg/commands/alias/vcl/snippet/create.go b/pkg/commands/alias/vcl/snippet/create.go new file mode 100644 index 000000000..ffe8f9d43 --- /dev/null +++ b/pkg/commands/alias/vcl/snippet/create.go @@ -0,0 +1,29 @@ +package snippet + +import ( + "io" + + newcmd "github.com/fastly/cli/pkg/commands/service/vcl/snippet" + + "github.com/fastly/cli/pkg/argparser" + "github.com/fastly/cli/pkg/global" + "github.com/fastly/cli/pkg/text" +) + +// CreateCommand wraps the CreateCommand from the newcmd package. +type CreateCommand struct { + *newcmd.CreateCommand +} + +// NewCreateCommand returns a usable command registered under the parent. +func NewCreateCommand(parent argparser.Registerer, g *global.Data) *CreateCommand { + c := CreateCommand{newcmd.NewCreateCommand(parent, g)} + c.CmdClause.Hidden() + return &c +} + +// Exec implements the command interface. +func (c *CreateCommand) Exec(in io.Reader, out io.Writer) error { + text.Deprecated(out, "Use the 'service vcl snippet create' command instead.") + return c.CreateCommand.Exec(in, out) +} diff --git a/pkg/commands/alias/vcl/snippet/delete.go b/pkg/commands/alias/vcl/snippet/delete.go new file mode 100644 index 000000000..e1e453e7b --- /dev/null +++ b/pkg/commands/alias/vcl/snippet/delete.go @@ -0,0 +1,29 @@ +package snippet + +import ( + "io" + + newcmd "github.com/fastly/cli/pkg/commands/service/vcl/snippet" + + "github.com/fastly/cli/pkg/argparser" + "github.com/fastly/cli/pkg/global" + "github.com/fastly/cli/pkg/text" +) + +// DeleteCommand wraps the DeleteCommand from the newcmd package. +type DeleteCommand struct { + *newcmd.DeleteCommand +} + +// NewDeleteCommand returns a usable command registered under the parent. +func NewDeleteCommand(parent argparser.Registerer, g *global.Data) *DeleteCommand { + c := DeleteCommand{newcmd.NewDeleteCommand(parent, g)} + c.CmdClause.Hidden() + return &c +} + +// Exec implements the command interface. +func (c *DeleteCommand) Exec(in io.Reader, out io.Writer) error { + text.Deprecated(out, "Use the 'service vcl snippet delete' command instead.") + return c.DeleteCommand.Exec(in, out) +} diff --git a/pkg/commands/alias/vcl/snippet/describe.go b/pkg/commands/alias/vcl/snippet/describe.go new file mode 100644 index 000000000..e82245476 --- /dev/null +++ b/pkg/commands/alias/vcl/snippet/describe.go @@ -0,0 +1,29 @@ +package snippet + +import ( + "io" + + newcmd "github.com/fastly/cli/pkg/commands/service/vcl/snippet" + + "github.com/fastly/cli/pkg/argparser" + "github.com/fastly/cli/pkg/global" + "github.com/fastly/cli/pkg/text" +) + +// DescribeCommand wraps the DescribeCommand from the newcmd package. +type DescribeCommand struct { + *newcmd.DescribeCommand +} + +// NewDescribeCommand returns a usable command registered under the parent. +func NewDescribeCommand(parent argparser.Registerer, g *global.Data) *DescribeCommand { + c := DescribeCommand{newcmd.NewDescribeCommand(parent, g)} + c.CmdClause.Hidden() + return &c +} + +// Exec implements the command interface. +func (c *DescribeCommand) Exec(in io.Reader, out io.Writer) error { + text.Deprecated(out, "Use the 'service vcl snippet describe' command instead.") + return c.DescribeCommand.Exec(in, out) +} diff --git a/pkg/commands/alias/vcl/snippet/doc.go b/pkg/commands/alias/vcl/snippet/doc.go new file mode 100644 index 000000000..1df8057e3 --- /dev/null +++ b/pkg/commands/alias/vcl/snippet/doc.go @@ -0,0 +1,2 @@ +// Package snippet contains deprecated aliases for the 'service vcl' snippet commands. +package snippet diff --git a/pkg/commands/alias/vcl/snippet/list.go b/pkg/commands/alias/vcl/snippet/list.go new file mode 100644 index 000000000..87ee855ca --- /dev/null +++ b/pkg/commands/alias/vcl/snippet/list.go @@ -0,0 +1,31 @@ +package snippet + +import ( + "io" + + newcmd "github.com/fastly/cli/pkg/commands/service/vcl/snippet" + + "github.com/fastly/cli/pkg/argparser" + "github.com/fastly/cli/pkg/global" + "github.com/fastly/cli/pkg/text" +) + +// ListCommand wraps the ListCommand from the newcmd package. +type ListCommand struct { + *newcmd.ListCommand +} + +// NewListCommand returns a usable command registered under the parent. +func NewListCommand(parent argparser.Registerer, g *global.Data) *ListCommand { + c := ListCommand{newcmd.NewListCommand(parent, g)} + c.CmdClause.Hidden() + return &c +} + +// Exec implements the command interface. +func (c *ListCommand) Exec(in io.Reader, out io.Writer) error { + if !c.JSONOutput.Enabled { + text.Deprecated(out, "Use the 'service vcl snippet list' command instead.") + } + return c.ListCommand.Exec(in, out) +} diff --git a/pkg/commands/alias/vcl/snippet/root.go b/pkg/commands/alias/vcl/snippet/root.go new file mode 100644 index 000000000..478a39d3c --- /dev/null +++ b/pkg/commands/alias/vcl/snippet/root.go @@ -0,0 +1,31 @@ +package snippet + +import ( + "io" + + "github.com/fastly/cli/pkg/argparser" + "github.com/fastly/cli/pkg/global" +) + +// RootCommand is the parent command for all subcommands in this package. +// It should be installed under the primary root command. +type RootCommand struct { + argparser.Base + // no flags +} + +// CommandName is the string to be used to invoke this command. +const CommandName = "snippet" + +// NewRootCommand returns a new command registered in the parent. +func NewRootCommand(parent argparser.Registerer, g *global.Data) *RootCommand { + var c RootCommand + c.Globals = g + c.CmdClause = parent.Command(CommandName, "Manipulate Fastly VCL snippets").Hidden() + return &c +} + +// Exec implements the command interface. +func (c *RootCommand) Exec(_ io.Reader, _ io.Writer) error { + panic("unreachable") +} diff --git a/pkg/commands/alias/vcl/snippet/update.go b/pkg/commands/alias/vcl/snippet/update.go new file mode 100644 index 000000000..f732abace --- /dev/null +++ b/pkg/commands/alias/vcl/snippet/update.go @@ -0,0 +1,29 @@ +package snippet + +import ( + "io" + + newcmd "github.com/fastly/cli/pkg/commands/service/vcl/snippet" + + "github.com/fastly/cli/pkg/argparser" + "github.com/fastly/cli/pkg/global" + "github.com/fastly/cli/pkg/text" +) + +// UpdateCommand wraps the UpdateCommand from the newcmd package. +type UpdateCommand struct { + *newcmd.UpdateCommand +} + +// NewUpdateCommand returns a usable command registered under the parent. +func NewUpdateCommand(parent argparser.Registerer, g *global.Data) *UpdateCommand { + c := UpdateCommand{newcmd.NewUpdateCommand(parent, g)} + c.CmdClause.Hidden() + return &c +} + +// Exec implements the command interface. +func (c *UpdateCommand) Exec(in io.Reader, out io.Writer) error { + text.Deprecated(out, "Use the 'service vcl snippet update' command instead.") + return c.UpdateCommand.Exec(in, out) +} diff --git a/pkg/commands/commands.go b/pkg/commands/commands.go index 2f706fbc1..c0fc6ba1c 100644 --- a/pkg/commands/commands.go +++ b/pkg/commands/commands.go @@ -8,6 +8,10 @@ import ( "github.com/fastly/cli/pkg/commands/aclentry" "github.com/fastly/cli/pkg/commands/alerts" aliaspurge "github.com/fastly/cli/pkg/commands/alias/purge" + aliasvcl "github.com/fastly/cli/pkg/commands/alias/vcl" + aliasvclcondition "github.com/fastly/cli/pkg/commands/alias/vcl/condition" + aliasvclcustom "github.com/fastly/cli/pkg/commands/alias/vcl/custom" + aliasvclsnippet "github.com/fastly/cli/pkg/commands/alias/vcl/snippet" aliasserviceversion "github.com/fastly/cli/pkg/commands/alias/serviceversion" "github.com/fastly/cli/pkg/commands/authtoken" "github.com/fastly/cli/pkg/commands/backend" @@ -96,6 +100,10 @@ import ( "github.com/fastly/cli/pkg/commands/service" servicedomain "github.com/fastly/cli/pkg/commands/service/domain" servicepurge "github.com/fastly/cli/pkg/commands/service/purge" + servicevcl "github.com/fastly/cli/pkg/commands/service/vcl" + servicevclcondition "github.com/fastly/cli/pkg/commands/service/vcl/condition" + servicevclcustom "github.com/fastly/cli/pkg/commands/service/vcl/custom" + servicevclsnippet "github.com/fastly/cli/pkg/commands/service/vcl/snippet" serviceversion "github.com/fastly/cli/pkg/commands/service/version" "github.com/fastly/cli/pkg/commands/serviceauth" "github.com/fastly/cli/pkg/commands/shellcomplete" @@ -113,10 +121,6 @@ import ( domainTools "github.com/fastly/cli/pkg/commands/tools/domain" "github.com/fastly/cli/pkg/commands/update" "github.com/fastly/cli/pkg/commands/user" - "github.com/fastly/cli/pkg/commands/vcl" - "github.com/fastly/cli/pkg/commands/vcl/condition" - "github.com/fastly/cli/pkg/commands/vcl/custom" - "github.com/fastly/cli/pkg/commands/vcl/snippet" "github.com/fastly/cli/pkg/commands/version" "github.com/fastly/cli/pkg/commands/whoami" "github.com/fastly/cli/pkg/global" @@ -624,6 +628,26 @@ func Define( // nolint:revive // function-length serviceauthDescribe := serviceauth.NewDescribeCommand(serviceauthCmdRoot.CmdClause, data) serviceauthList := serviceauth.NewListCommand(serviceauthCmdRoot.CmdClause, data) serviceauthUpdate := serviceauth.NewUpdateCommand(serviceauthCmdRoot.CmdClause, data) + servicevclCmdRoot := servicevcl.NewRootCommand(serviceCmdRoot.CmdClause, data) + servicevclDescribe := servicevcl.NewDescribeCommand(servicevclCmdRoot.CmdClause, data) + servicevclConditionCmdRoot := servicevclcondition.NewRootCommand(servicevclCmdRoot.CmdClause, data) + servicevclConditionCreate := servicevclcondition.NewCreateCommand(servicevclConditionCmdRoot.CmdClause, data) + servicevclConditionDelete := servicevclcondition.NewDeleteCommand(servicevclConditionCmdRoot.CmdClause, data) + servicevclConditionDescribe := servicevclcondition.NewDescribeCommand(servicevclConditionCmdRoot.CmdClause, data) + servicevclConditionList := servicevclcondition.NewListCommand(servicevclConditionCmdRoot.CmdClause, data) + servicevclConditionUpdate := servicevclcondition.NewUpdateCommand(servicevclConditionCmdRoot.CmdClause, data) + servicevclCustomCmdRoot := servicevclcustom.NewRootCommand(servicevclCmdRoot.CmdClause, data) + servicevclCustomCreate := servicevclcustom.NewCreateCommand(servicevclCustomCmdRoot.CmdClause, data) + servicevclCustomDelete := servicevclcustom.NewDeleteCommand(servicevclCustomCmdRoot.CmdClause, data) + servicevclCustomDescribe := servicevclcustom.NewDescribeCommand(servicevclCustomCmdRoot.CmdClause, data) + servicevclCustomList := servicevclcustom.NewListCommand(servicevclCustomCmdRoot.CmdClause, data) + servicevclCustomUpdate := servicevclcustom.NewUpdateCommand(servicevclCustomCmdRoot.CmdClause, data) + servicevclSnippetCmdRoot := servicevclsnippet.NewRootCommand(servicevclCmdRoot.CmdClause, data) + servicevclSnippetCreate := servicevclsnippet.NewCreateCommand(servicevclSnippetCmdRoot.CmdClause, data) + servicevclSnippetDelete := servicevclsnippet.NewDeleteCommand(servicevclSnippetCmdRoot.CmdClause, data) + servicevclSnippetDescribe := servicevclsnippet.NewDescribeCommand(servicevclSnippetCmdRoot.CmdClause, data) + servicevclSnippetList := servicevclsnippet.NewListCommand(servicevclSnippetCmdRoot.CmdClause, data) + servicevclSnippetUpdate := servicevclsnippet.NewUpdateCommand(servicevclSnippetCmdRoot.CmdClause, data) serviceVersionCmdRoot := serviceversion.NewRootCommand(serviceCmdRoot.CmdClause, data) serviceVersionActivate := serviceversion.NewActivateCommand(serviceVersionCmdRoot.CmdClause, data) serviceVersionClone := serviceversion.NewCloneCommand(serviceVersionCmdRoot.CmdClause, data) @@ -691,31 +715,31 @@ func Define( // nolint:revive // function-length userDescribe := user.NewDescribeCommand(userCmdRoot.CmdClause, data) userList := user.NewListCommand(userCmdRoot.CmdClause, data) userUpdate := user.NewUpdateCommand(userCmdRoot.CmdClause, data) - vclCmdRoot := vcl.NewRootCommand(app, data) - vclDescribe := vcl.NewDescribeCommand(vclCmdRoot.CmdClause, data) - vclConditionCmdRoot := condition.NewRootCommand(vclCmdRoot.CmdClause, data) - vclConditionCreate := condition.NewCreateCommand(vclConditionCmdRoot.CmdClause, data) - vclConditionDelete := condition.NewDeleteCommand(vclConditionCmdRoot.CmdClause, data) - vclConditionDescribe := condition.NewDescribeCommand(vclConditionCmdRoot.CmdClause, data) - vclConditionList := condition.NewListCommand(vclConditionCmdRoot.CmdClause, data) - vclConditionUpdate := condition.NewUpdateCommand(vclConditionCmdRoot.CmdClause, data) - vclCustomCmdRoot := custom.NewRootCommand(vclCmdRoot.CmdClause, data) - vclCustomCreate := custom.NewCreateCommand(vclCustomCmdRoot.CmdClause, data) - vclCustomDelete := custom.NewDeleteCommand(vclCustomCmdRoot.CmdClause, data) - vclCustomDescribe := custom.NewDescribeCommand(vclCustomCmdRoot.CmdClause, data) - vclCustomList := custom.NewListCommand(vclCustomCmdRoot.CmdClause, data) - vclCustomUpdate := custom.NewUpdateCommand(vclCustomCmdRoot.CmdClause, data) - vclSnippetCmdRoot := snippet.NewRootCommand(vclCmdRoot.CmdClause, data) - vclSnippetCreate := snippet.NewCreateCommand(vclSnippetCmdRoot.CmdClause, data) - vclSnippetDelete := snippet.NewDeleteCommand(vclSnippetCmdRoot.CmdClause, data) - vclSnippetDescribe := snippet.NewDescribeCommand(vclSnippetCmdRoot.CmdClause, data) - vclSnippetList := snippet.NewListCommand(vclSnippetCmdRoot.CmdClause, data) - vclSnippetUpdate := snippet.NewUpdateCommand(vclSnippetCmdRoot.CmdClause, data) versionCmdRoot := version.NewRootCommand(app, data) whoamiCmdRoot := whoami.NewRootCommand(app, data) // Aliases for deprecated commands aliasPurge := aliaspurge.NewCommand(app, data) + aliasVclRoot := aliasvcl.NewRootCommand(app, data) + aliasVclDescribe := aliasvcl.NewDescribeCommand(aliasVclRoot.CmdClause, data) + aliasVclConditionRoot := aliasvclcondition.NewRootCommand(aliasVclRoot.CmdClause, data) + aliasVclConditionCreate := aliasvclcondition.NewCreateCommand(aliasVclConditionRoot.CmdClause, data) + aliasVclConditionDelete := aliasvclcondition.NewDeleteCommand(aliasVclConditionRoot.CmdClause, data) + aliasVclConditionDescribe := aliasvclcondition.NewDescribeCommand(aliasVclConditionRoot.CmdClause, data) + aliasVclConditionList := aliasvclcondition.NewListCommand(aliasVclConditionRoot.CmdClause, data) + aliasVclConditionUpdate := aliasvclcondition.NewUpdateCommand(aliasVclConditionRoot.CmdClause, data) + aliasVclCustomRoot := aliasvclcustom.NewRootCommand(aliasVclRoot.CmdClause, data) + aliasVclCustomCreate := aliasvclcustom.NewCreateCommand(aliasVclCustomRoot.CmdClause, data) + aliasVclCustomDelete := aliasvclcustom.NewDeleteCommand(aliasVclCustomRoot.CmdClause, data) + aliasVclCustomDescribe := aliasvclcustom.NewDescribeCommand(aliasVclCustomRoot.CmdClause, data) + aliasVclCustomList := aliasvclcustom.NewListCommand(aliasVclCustomRoot.CmdClause, data) + aliasVclCustomUpdate := aliasvclcustom.NewUpdateCommand(aliasVclCustomRoot.CmdClause, data) + aliasVclSnippetRoot := aliasvclsnippet.NewRootCommand(aliasVclRoot.CmdClause, data) + aliasVclSnippetCreate := aliasvclsnippet.NewCreateCommand(aliasVclSnippetRoot.CmdClause, data) + aliasVclSnippetDelete := aliasvclsnippet.NewDeleteCommand(aliasVclSnippetRoot.CmdClause, data) + aliasVclSnippetDescribe := aliasvclsnippet.NewDescribeCommand(aliasVclSnippetRoot.CmdClause, data) + aliasVclSnippetList := aliasvclsnippet.NewListCommand(aliasVclSnippetRoot.CmdClause, data) + aliasVclSnippetUpdate := aliasvclsnippet.NewUpdateCommand(aliasVclSnippetRoot.CmdClause, data) aliasServiceVersionRoot := aliasserviceversion.NewRootCommand(app, data) aliasServiceVersionActivate := aliasserviceversion.NewActivateCommand(aliasServiceVersionRoot.CmdClause, data) aliasServiceVersionClone := aliasserviceversion.NewCloneCommand(aliasServiceVersionRoot.CmdClause, data) @@ -1208,6 +1232,26 @@ func Define( // nolint:revive // function-length serviceauthDescribe, serviceauthList, serviceauthUpdate, + servicevclCmdRoot, + servicevclDescribe, + servicevclConditionCmdRoot, + servicevclConditionCreate, + servicevclConditionDelete, + servicevclConditionDescribe, + servicevclConditionList, + servicevclConditionUpdate, + servicevclCustomCmdRoot, + servicevclCustomCreate, + servicevclCustomDelete, + servicevclCustomDescribe, + servicevclCustomList, + servicevclCustomUpdate, + servicevclSnippetCmdRoot, + servicevclSnippetCreate, + servicevclSnippetDelete, + servicevclSnippetDescribe, + servicevclSnippetList, + servicevclSnippetUpdate, servicedomainCmdRoot, servicedomainCreate, servicedomainDelete, @@ -1276,29 +1320,25 @@ func Define( // nolint:revive // function-length userDescribe, userList, userUpdate, - vclCmdRoot, - vclDescribe, - vclConditionCmdRoot, - vclConditionCreate, - vclConditionDelete, - vclConditionDescribe, - vclConditionList, - vclConditionUpdate, - vclCustomCmdRoot, - vclCustomCreate, - vclCustomDelete, - vclCustomDescribe, - vclCustomList, - vclCustomUpdate, - vclSnippetCmdRoot, - vclSnippetCreate, - vclSnippetDelete, - vclSnippetDescribe, - vclSnippetList, - vclSnippetUpdate, versionCmdRoot, whoamiCmdRoot, aliasPurge, + aliasVclDescribe, + aliasVclConditionCreate, + aliasVclConditionDelete, + aliasVclConditionDescribe, + aliasVclConditionList, + aliasVclConditionUpdate, + aliasVclCustomCreate, + aliasVclCustomDelete, + aliasVclCustomDescribe, + aliasVclCustomList, + aliasVclCustomUpdate, + aliasVclSnippetCreate, + aliasVclSnippetDelete, + aliasVclSnippetDescribe, + aliasVclSnippetList, + aliasVclSnippetUpdate, aliasServiceVersionActivate, aliasServiceVersionClone, aliasServiceVersionDeactivate, diff --git a/pkg/commands/vcl/condition/condition_test.go b/pkg/commands/service/vcl/condition/condition_test.go similarity index 92% rename from pkg/commands/vcl/condition/condition_test.go rename to pkg/commands/service/vcl/condition/condition_test.go index f6dffe231..ec226b50d 100644 --- a/pkg/commands/vcl/condition/condition_test.go +++ b/pkg/commands/service/vcl/condition/condition_test.go @@ -8,8 +8,9 @@ import ( "github.com/fastly/go-fastly/v12/fastly" - root "github.com/fastly/cli/pkg/commands/vcl" - sub "github.com/fastly/cli/pkg/commands/vcl/condition" + top "github.com/fastly/cli/pkg/commands/service" + root "github.com/fastly/cli/pkg/commands/service/vcl" + sub "github.com/fastly/cli/pkg/commands/service/vcl/condition" "github.com/fastly/cli/pkg/mock" "github.com/fastly/cli/pkg/testutil" ) @@ -40,7 +41,7 @@ func TestConditionCreate(t *testing.T) { }, } - testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "create"}, scenarios) + testutil.RunCLIScenarios(t, []string{top.CommandName, root.CommandName, sub.CommandName, "create"}, scenarios) } func TestConditionDelete(t *testing.T) { @@ -69,7 +70,7 @@ func TestConditionDelete(t *testing.T) { }, } - testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "delete"}, scenarios) + testutil.RunCLIScenarios(t, []string{top.CommandName, root.CommandName, sub.CommandName, "delete"}, scenarios) } func TestConditionUpdate(t *testing.T) { @@ -107,7 +108,7 @@ func TestConditionUpdate(t *testing.T) { }, } - testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "update"}, scenarios) + testutil.RunCLIScenarios(t, []string{top.CommandName, root.CommandName, sub.CommandName, "update"}, scenarios) } func TestConditionDescribe(t *testing.T) { @@ -134,7 +135,7 @@ func TestConditionDescribe(t *testing.T) { }, } - testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "describe"}, scenarios) + testutil.RunCLIScenarios(t, []string{top.CommandName, root.CommandName, sub.CommandName, "describe"}, scenarios) } func TestConditionList(t *testing.T) { @@ -189,7 +190,7 @@ func TestConditionList(t *testing.T) { }, } - testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "list"}, scenarios) + testutil.RunCLIScenarios(t, []string{top.CommandName, root.CommandName, sub.CommandName, "list"}, scenarios) } var describeConditionOutput = "\n" + strings.TrimSpace(` diff --git a/pkg/commands/vcl/condition/create.go b/pkg/commands/service/vcl/condition/create.go similarity index 100% rename from pkg/commands/vcl/condition/create.go rename to pkg/commands/service/vcl/condition/create.go diff --git a/pkg/commands/vcl/condition/delete.go b/pkg/commands/service/vcl/condition/delete.go similarity index 100% rename from pkg/commands/vcl/condition/delete.go rename to pkg/commands/service/vcl/condition/delete.go diff --git a/pkg/commands/vcl/condition/describe.go b/pkg/commands/service/vcl/condition/describe.go similarity index 100% rename from pkg/commands/vcl/condition/describe.go rename to pkg/commands/service/vcl/condition/describe.go diff --git a/pkg/commands/vcl/condition/doc.go b/pkg/commands/service/vcl/condition/doc.go similarity index 100% rename from pkg/commands/vcl/condition/doc.go rename to pkg/commands/service/vcl/condition/doc.go diff --git a/pkg/commands/vcl/condition/list.go b/pkg/commands/service/vcl/condition/list.go similarity index 100% rename from pkg/commands/vcl/condition/list.go rename to pkg/commands/service/vcl/condition/list.go diff --git a/pkg/commands/vcl/condition/root.go b/pkg/commands/service/vcl/condition/root.go similarity index 100% rename from pkg/commands/vcl/condition/root.go rename to pkg/commands/service/vcl/condition/root.go diff --git a/pkg/commands/vcl/condition/update.go b/pkg/commands/service/vcl/condition/update.go similarity index 100% rename from pkg/commands/vcl/condition/update.go rename to pkg/commands/service/vcl/condition/update.go diff --git a/pkg/commands/vcl/custom/create.go b/pkg/commands/service/vcl/custom/create.go similarity index 100% rename from pkg/commands/vcl/custom/create.go rename to pkg/commands/service/vcl/custom/create.go diff --git a/pkg/commands/vcl/custom/custom_test.go b/pkg/commands/service/vcl/custom/custom_test.go similarity index 95% rename from pkg/commands/vcl/custom/custom_test.go rename to pkg/commands/service/vcl/custom/custom_test.go index a6d84d977..bdeb29c33 100644 --- a/pkg/commands/vcl/custom/custom_test.go +++ b/pkg/commands/service/vcl/custom/custom_test.go @@ -6,8 +6,9 @@ import ( "github.com/fastly/go-fastly/v12/fastly" - root "github.com/fastly/cli/pkg/commands/vcl" - sub "github.com/fastly/cli/pkg/commands/vcl/custom" + top "github.com/fastly/cli/pkg/commands/service" + root "github.com/fastly/cli/pkg/commands/service/vcl" + sub "github.com/fastly/cli/pkg/commands/service/vcl/custom" "github.com/fastly/cli/pkg/mock" "github.com/fastly/cli/pkg/testutil" ) @@ -166,7 +167,7 @@ func TestVCLCustomCreate(t *testing.T) { }, } - testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "create"}, scenarios) + testutil.RunCLIScenarios(t, []string{top.CommandName, root.CommandName, sub.CommandName, "create"}, scenarios) } func TestVCLCustomDelete(t *testing.T) { @@ -238,7 +239,7 @@ func TestVCLCustomDelete(t *testing.T) { }, } - testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "delete"}, scenarios) + testutil.RunCLIScenarios(t, []string{top.CommandName, root.CommandName, sub.CommandName, "delete"}, scenarios) } func TestVCLCustomDescribe(t *testing.T) { @@ -289,7 +290,7 @@ func TestVCLCustomDescribe(t *testing.T) { }, } - testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "describe"}, scenarios) + testutil.RunCLIScenarios(t, []string{top.CommandName, root.CommandName, sub.CommandName, "describe"}, scenarios) } func TestVCLCustomList(t *testing.T) { @@ -343,7 +344,7 @@ func TestVCLCustomList(t *testing.T) { }, } - testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "list"}, scenarios) + testutil.RunCLIScenarios(t, []string{top.CommandName, root.CommandName, sub.CommandName, "list"}, scenarios) } func TestVCLCustomUpdate(t *testing.T) { @@ -453,7 +454,7 @@ func TestVCLCustomUpdate(t *testing.T) { }, } - testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "update"}, scenarios) + testutil.RunCLIScenarios(t, []string{top.CommandName, root.CommandName, sub.CommandName, "update"}, scenarios) } func getVCL(_ context.Context, i *fastly.GetVCLInput) (*fastly.VCL, error) { diff --git a/pkg/commands/vcl/custom/delete.go b/pkg/commands/service/vcl/custom/delete.go similarity index 100% rename from pkg/commands/vcl/custom/delete.go rename to pkg/commands/service/vcl/custom/delete.go diff --git a/pkg/commands/vcl/custom/describe.go b/pkg/commands/service/vcl/custom/describe.go similarity index 100% rename from pkg/commands/vcl/custom/describe.go rename to pkg/commands/service/vcl/custom/describe.go diff --git a/pkg/commands/vcl/custom/doc.go b/pkg/commands/service/vcl/custom/doc.go similarity index 100% rename from pkg/commands/vcl/custom/doc.go rename to pkg/commands/service/vcl/custom/doc.go diff --git a/pkg/commands/vcl/custom/list.go b/pkg/commands/service/vcl/custom/list.go similarity index 100% rename from pkg/commands/vcl/custom/list.go rename to pkg/commands/service/vcl/custom/list.go diff --git a/pkg/commands/vcl/custom/root.go b/pkg/commands/service/vcl/custom/root.go similarity index 100% rename from pkg/commands/vcl/custom/root.go rename to pkg/commands/service/vcl/custom/root.go diff --git a/pkg/commands/vcl/custom/testdata/example.vcl b/pkg/commands/service/vcl/custom/testdata/example.vcl similarity index 100% rename from pkg/commands/vcl/custom/testdata/example.vcl rename to pkg/commands/service/vcl/custom/testdata/example.vcl diff --git a/pkg/commands/vcl/custom/update.go b/pkg/commands/service/vcl/custom/update.go similarity index 100% rename from pkg/commands/vcl/custom/update.go rename to pkg/commands/service/vcl/custom/update.go diff --git a/pkg/commands/vcl/describe.go b/pkg/commands/service/vcl/describe.go similarity index 100% rename from pkg/commands/vcl/describe.go rename to pkg/commands/service/vcl/describe.go diff --git a/pkg/commands/vcl/doc.go b/pkg/commands/service/vcl/doc.go similarity index 100% rename from pkg/commands/vcl/doc.go rename to pkg/commands/service/vcl/doc.go diff --git a/pkg/commands/vcl/root.go b/pkg/commands/service/vcl/root.go similarity index 100% rename from pkg/commands/vcl/root.go rename to pkg/commands/service/vcl/root.go diff --git a/pkg/commands/vcl/snippet/create.go b/pkg/commands/service/vcl/snippet/create.go similarity index 100% rename from pkg/commands/vcl/snippet/create.go rename to pkg/commands/service/vcl/snippet/create.go diff --git a/pkg/commands/vcl/snippet/delete.go b/pkg/commands/service/vcl/snippet/delete.go similarity index 100% rename from pkg/commands/vcl/snippet/delete.go rename to pkg/commands/service/vcl/snippet/delete.go diff --git a/pkg/commands/vcl/snippet/describe.go b/pkg/commands/service/vcl/snippet/describe.go similarity index 100% rename from pkg/commands/vcl/snippet/describe.go rename to pkg/commands/service/vcl/snippet/describe.go diff --git a/pkg/commands/vcl/snippet/doc.go b/pkg/commands/service/vcl/snippet/doc.go similarity index 100% rename from pkg/commands/vcl/snippet/doc.go rename to pkg/commands/service/vcl/snippet/doc.go diff --git a/pkg/commands/vcl/snippet/list.go b/pkg/commands/service/vcl/snippet/list.go similarity index 100% rename from pkg/commands/vcl/snippet/list.go rename to pkg/commands/service/vcl/snippet/list.go diff --git a/pkg/commands/vcl/snippet/root.go b/pkg/commands/service/vcl/snippet/root.go similarity index 100% rename from pkg/commands/vcl/snippet/root.go rename to pkg/commands/service/vcl/snippet/root.go diff --git a/pkg/commands/vcl/snippet/snippet_test.go b/pkg/commands/service/vcl/snippet/snippet_test.go similarity index 96% rename from pkg/commands/vcl/snippet/snippet_test.go rename to pkg/commands/service/vcl/snippet/snippet_test.go index 2184efde7..9e355ee4e 100644 --- a/pkg/commands/vcl/snippet/snippet_test.go +++ b/pkg/commands/service/vcl/snippet/snippet_test.go @@ -6,8 +6,9 @@ import ( "github.com/fastly/go-fastly/v12/fastly" - root "github.com/fastly/cli/pkg/commands/vcl" - sub "github.com/fastly/cli/pkg/commands/vcl/snippet" + top "github.com/fastly/cli/pkg/commands/service" + root "github.com/fastly/cli/pkg/commands/service/vcl" + sub "github.com/fastly/cli/pkg/commands/service/vcl/snippet" "github.com/fastly/cli/pkg/mock" "github.com/fastly/cli/pkg/testutil" ) @@ -220,7 +221,7 @@ func TestVCLSnippetCreate(t *testing.T) { }, } - testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "create"}, scenarios) + testutil.RunCLIScenarios(t, []string{top.CommandName, root.CommandName, sub.CommandName, "create"}, scenarios) } func TestVCLSnippetDelete(t *testing.T) { @@ -292,7 +293,7 @@ func TestVCLSnippetDelete(t *testing.T) { }, } - testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "delete"}, scenarios) + testutil.RunCLIScenarios(t, []string{top.CommandName, root.CommandName, sub.CommandName, "delete"}, scenarios) } func TestVCLSnippetDescribe(t *testing.T) { @@ -362,7 +363,7 @@ func TestVCLSnippetDescribe(t *testing.T) { }, } - testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "describe"}, scenarios) + testutil.RunCLIScenarios(t, []string{top.CommandName, root.CommandName, sub.CommandName, "describe"}, scenarios) } func TestVCLSnippetList(t *testing.T) { @@ -416,7 +417,7 @@ func TestVCLSnippetList(t *testing.T) { }, } - testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "list"}, scenarios) + testutil.RunCLIScenarios(t, []string{top.CommandName, root.CommandName, sub.CommandName, "list"}, scenarios) } func TestVCLSnippetUpdate(t *testing.T) { @@ -556,7 +557,7 @@ func TestVCLSnippetUpdate(t *testing.T) { }, } - testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "update"}, scenarios) + testutil.RunCLIScenarios(t, []string{top.CommandName, root.CommandName, sub.CommandName, "update"}, scenarios) } func getSnippet(_ context.Context, i *fastly.GetSnippetInput) (*fastly.Snippet, error) { diff --git a/pkg/commands/vcl/snippet/testdata/snippet.vcl b/pkg/commands/service/vcl/snippet/testdata/snippet.vcl similarity index 100% rename from pkg/commands/vcl/snippet/testdata/snippet.vcl rename to pkg/commands/service/vcl/snippet/testdata/snippet.vcl diff --git a/pkg/commands/vcl/snippet/update.go b/pkg/commands/service/vcl/snippet/update.go similarity index 100% rename from pkg/commands/vcl/snippet/update.go rename to pkg/commands/service/vcl/snippet/update.go diff --git a/pkg/commands/vcl/vcl_test.go b/pkg/commands/service/vcl/vcl_test.go similarity index 91% rename from pkg/commands/vcl/vcl_test.go rename to pkg/commands/service/vcl/vcl_test.go index 9ea9e5ec6..ac8577927 100644 --- a/pkg/commands/vcl/vcl_test.go +++ b/pkg/commands/service/vcl/vcl_test.go @@ -6,7 +6,8 @@ import ( "github.com/fastly/go-fastly/v12/fastly" - root "github.com/fastly/cli/pkg/commands/vcl" + root "github.com/fastly/cli/pkg/commands/service" + sub "github.com/fastly/cli/pkg/commands/service/vcl" "github.com/fastly/cli/pkg/mock" "github.com/fastly/cli/pkg/testutil" ) @@ -53,7 +54,7 @@ func TestVCLDescribe(t *testing.T) { }, } - testutil.RunCLIScenarios(t, []string{root.CommandName, "describe"}, scenarios) + testutil.RunCLIScenarios(t, []string{root.CommandName, sub.CommandName, "describe"}, scenarios) } func getVCL(_ context.Context, i *fastly.GetGeneratedVCLInput) (*fastly.VCL, error) {