Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [Unreleased]

### Breaking:
- breaking(vcl): moved the `vcl` command under the `service` command ([#1616](https://github.com/fastly/cli/pull/1616))

### Enhancements:
- feat(rust): Allow testing with prerelease Rust versions ([#1604](https://github.com/fastly/cli/pull/1604))
Expand Down
1 change: 0 additions & 1 deletion pkg/app/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ tls-subscription
tools
update
user
vcl
version
whoami
`,
Expand Down
88 changes: 44 additions & 44 deletions pkg/commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ import (
"github.com/fastly/cli/pkg/commands/secretstoreentry"
"github.com/fastly/cli/pkg/commands/service"
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"
"github.com/fastly/cli/pkg/commands/serviceauth"
"github.com/fastly/cli/pkg/commands/serviceversion"
"github.com/fastly/cli/pkg/commands/shellcomplete"
Expand All @@ -112,10 +116,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"
Expand Down Expand Up @@ -630,6 +630,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(app, data)
serviceVersionActivate := serviceversion.NewActivateCommand(serviceVersionCmdRoot.CmdClause, data)
serviceVersionClone := serviceversion.NewCloneCommand(serviceVersionCmdRoot.CmdClause, data)
Expand Down Expand Up @@ -690,26 +710,6 @@ 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)

Expand Down Expand Up @@ -1205,6 +1205,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,
serviceVersionActivate,
serviceVersionClone,
serviceVersionCmdRoot,
Expand Down Expand Up @@ -1266,26 +1286,6 @@ 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't too sure on the naming convention here. Open to discuss how we should refer to this nested top level command.

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"
)
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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(`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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) {
Expand Down