From 0bbd0d7e16e1e6543e899d5d015354d63b3372db Mon Sep 17 00:00:00 2001 From: Herve ESTEGUET Date: Tue, 21 May 2024 08:54:34 +0200 Subject: [PATCH] Group worker commands into a namespace --- cli/cli.go | 40 +++++++++++++++++++++--------------- go.mod | 2 +- itests/infra/itest_runner.go | 2 +- main.go | 2 +- 4 files changed, 26 insertions(+), 20 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index 8f53da4..c058523 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -5,24 +5,30 @@ import ( "github.com/jfrog/jfrog-cli-platform-services/commands" ) -func GetWorkerApp() components.App { - app := components.App{} - app.Name = "worker" - app.Description = "Tools for managing workers" - app.Version = "v1.0.0" - app.Commands = getWorkerCommands() - return app +const category = "Platform Services" + +func GetPlatformServicesApp() components.App { + return components.CreateEmbeddedApp( + category, + nil, + getWorkerNamespace(), + ) } -func getWorkerCommands() []components.Command { - return []components.Command{ - commands.GetInitCommand(), - commands.GetDryRunCommand(), - commands.GetDeployCommand(), - commands.GetExecuteCommand(), - commands.GetRemoveCommand(), - commands.GetListCommand(), - commands.GetAddSecretCommand(), - commands.GetListEventsCommand(), +func getWorkerNamespace() components.Namespace { + return components.Namespace{ + Name: "worker", + Description: "Tools for managing workers", + Category: category, + Commands: []components.Command{ + commands.GetInitCommand(), + commands.GetDryRunCommand(), + commands.GetDeployCommand(), + commands.GetExecuteCommand(), + commands.GetRemoveCommand(), + commands.GetListCommand(), + commands.GetAddSecretCommand(), + commands.GetListEventsCommand(), + }, } } diff --git a/go.mod b/go.mod index 084ee75..c9ae675 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,7 @@ module github.com/jfrog/jfrog-cli-platform-services require ( + github.com/google/uuid v1.6.0 github.com/jfrog/jfrog-cli-core/v2 v2.51.0 github.com/jfrog/jfrog-client-go v1.40.1 github.com/stretchr/testify v1.9.0 @@ -31,7 +32,6 @@ require ( github.com/golang-jwt/jwt/v4 v4.5.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/snappy v0.0.4 // indirect - github.com/google/uuid v1.6.0 // indirect github.com/gookit/color v1.5.4 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect diff --git a/itests/infra/itest_runner.go b/itests/infra/itest_runner.go index d1740c1..d444f7f 100644 --- a/itests/infra/itest_runner.go +++ b/itests/infra/itest_runner.go @@ -46,7 +46,7 @@ type Test struct { t *testing.T } -var runPlugin = plugins.RunCliWithPlugin(cli.GetWorkerApp()) +var runPlugin = plugins.RunCliWithPlugin(cli.GetPlatformServicesApp()) func RunITests(tests []TestDefinition, t *testing.T) { if testing.Short() { diff --git a/main.go b/main.go index e755d25..a342a1f 100644 --- a/main.go +++ b/main.go @@ -6,5 +6,5 @@ import ( ) func main() { - plugins.PluginMain(cli.GetWorkerApp()) + plugins.PluginMain(cli.GetPlatformServicesApp()) }