Skip to content
Merged
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
12 changes: 6 additions & 6 deletions apptrust/commands/application/create_app_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (cac *createAppCommand) ServerDetails() (*coreConfig.ServerDetails, error)
}

func (cac *createAppCommand) CommandName() string {
return commands.CreateApp
return commands.AppCreate
}

func (cac *createAppCommand) buildRequestPayload(ctx *components.Context) (*model.AppDescriptor, error) {
Expand Down Expand Up @@ -118,18 +118,18 @@ func GetCreateAppCommand(appContext app.Context) components.Command {
applicationService: appContext.GetApplicationService(),
}
return components.Command{
Name: "create",
Description: "Create a new application",
Name: commands.AppCreate,
Description: "Create a new application.",
Category: common.CategoryApplication,
Aliases: []string{"c"},
Aliases: []string{"ac"},
Arguments: []components.Argument{
{
Name: "application-key",
Description: "The key of the application to create",
Description: "The key of the application to create.",
Optional: false,
},
},
Flags: commands.GetCommandFlags(commands.CreateApp),
Flags: commands.GetCommandFlags(commands.AppCreate),
Action: cmd.prepareAndRunCommand,
}
}
10 changes: 5 additions & 5 deletions apptrust/commands/application/delete_app_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (dac *deleteAppCommand) ServerDetails() (*coreConfig.ServerDetails, error)
}

func (dac *deleteAppCommand) CommandName() string {
return commands.DeleteApp
return commands.AppDelete
}

func (dac *deleteAppCommand) prepareAndRunCommand(ctx *components.Context) error {
Expand All @@ -58,14 +58,14 @@ func GetDeleteAppCommand(appContext app.Context) components.Command {
applicationService: appContext.GetApplicationService(),
}
return components.Command{
Name: "delete",
Description: "Delete an application",
Name: commands.AppDelete,
Description: "Delete an application.",
Category: common.CategoryApplication,
Aliases: []string{"d"},
Aliases: []string{"ad"},
Arguments: []components.Argument{
{
Name: "application-key",
Description: "The key of the application to delete",
Description: "The key of the application to delete.",
Optional: false,
},
},
Expand Down
10 changes: 4 additions & 6 deletions apptrust/commands/application/update_app_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import (
coreConfig "github.com/jfrog/jfrog-cli-core/v2/utils/config"
)

const UpdateApp = "update-app"

type updateAppCommand struct {
serverDetails *coreConfig.ServerDetails
applicationService applications.ApplicationService
Expand All @@ -37,7 +35,7 @@ func (uac *updateAppCommand) ServerDetails() (*coreConfig.ServerDetails, error)
}

func (uac *updateAppCommand) CommandName() string {
return UpdateApp
return commands.AppUpdate
}

func (uac *updateAppCommand) buildRequestPayload(ctx *components.Context) (*model.AppDescriptor, error) {
Expand Down Expand Up @@ -108,18 +106,18 @@ func GetUpdateAppCommand(appContext app.Context) components.Command {
applicationService: appContext.GetApplicationService(),
}
return components.Command{
Name: "update",
Name: commands.AppUpdate,
Description: "Update an existing application",
Category: common.CategoryApplication,
Aliases: []string{"u"},
Aliases: []string{"au"},
Arguments: []components.Argument{
{
Name: "application-key",
Description: "The key of the application to update",
Optional: false,
},
},
Flags: commands.GetCommandFlags(commands.UpdateApp),
Flags: commands.GetCommandFlags(commands.AppUpdate),
Action: cmd.prepareAndRunCommand,
}
}
30 changes: 15 additions & 15 deletions apptrust/commands/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import (
)

const (
Ping = "ping"
CreateAppVersion = "version-create"
PromoteAppVersion = "version-promote"
DeleteAppVersion = "version-delete"
PackageBind = "package-bind"
PackageUnbind = "package-unbind"
CreateApp = "app-create"
UpdateApp = "app-update"
DeleteApp = "app-delete"
Ping = "ping"
VersionCreate = "version-create"
VersionPromote = "version-promote"
VersionDelete = "version-delete"
PackageBind = "package-bind"
PackageUnbind = "package-unbind"
AppCreate = "app-create"
AppUpdate = "app-update"
AppDelete = "app-delete"
)

const (
Expand Down Expand Up @@ -82,7 +82,7 @@ var flagsMap = map[string]components.Flag{
}

var commandFlags = map[string][]string{
CreateAppVersion: {
VersionCreate: {
url,
user,
accessToken,
Expand All @@ -95,7 +95,7 @@ var commandFlags = map[string][]string{
SpecFlag,
SpecVarsFlag,
},
PromoteAppVersion: {
VersionPromote: {
url,
user,
accessToken,
Expand All @@ -106,7 +106,7 @@ var commandFlags = map[string][]string{
ExcludeReposFlag,
IncludeReposFlag,
},
DeleteAppVersion: {
VersionDelete: {
url,
user,
accessToken,
Expand Down Expand Up @@ -134,7 +134,7 @@ var commandFlags = map[string][]string{
serverId,
},

CreateApp: {
AppCreate: {
url,
user,
accessToken,
Expand All @@ -152,7 +152,7 @@ var commandFlags = map[string][]string{
SpecVarsFlag,
},

UpdateApp: {
AppUpdate: {
url,
user,
accessToken,
Expand All @@ -169,7 +169,7 @@ var commandFlags = map[string][]string{
SpecVarsFlag,
},

DeleteApp: {
AppDelete: {
url,
user,
accessToken,
Expand Down
2 changes: 1 addition & 1 deletion apptrust/commands/package/bind_package_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func GetBindPackageCommand(appContext app.Context) components.Command {
cmd := &bindPackageCommand{packageService: appContext.GetPackageService()}
return components.Command{
Name: commands.PackageBind,
Description: "Bind packages to an application",
Description: "Bind packages to an application.",
Category: common.CategoryPackage,
Aliases: []string{"pb"},
Arguments: []components.Argument{
Expand Down
2 changes: 1 addition & 1 deletion apptrust/commands/package/unbind_package_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func GetUnbindPackageCommand(appContext app.Context) components.Command {
cmd := &unbindPackageCommand{packageService: appContext.GetPackageService()}
return components.Command{
Name: commands.PackageUnbind,
Description: "Unbind packages from an application",
Description: "Unbind packages from an application.",
Category: common.CategoryPackage,
Aliases: []string{"pu"},
Arguments: []components.Argument{
Expand Down
2 changes: 1 addition & 1 deletion apptrust/commands/system/ping_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func GetPingCommand(appContext app.Context) components.Command {
cmd := &pingCommand{systemService: appContext.GetSystemService()}
return components.Command{
Name: commands.Ping,
Description: "Ping the application server",
Description: "Ping AppTrust server.",
Category: common.CategorySystem,
Aliases: []string{"p"},
Arguments: []components.Argument{},
Expand Down
10 changes: 5 additions & 5 deletions apptrust/commands/version/create_app_version_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (cv *createAppVersionCommand) ServerDetails() (*coreConfig.ServerDetails, e
}

func (cv *createAppVersionCommand) CommandName() string {
return commands.CreateAppVersion
return commands.VersionCreate
}

func (cv *createAppVersionCommand) prepareAndRunCommand(ctx *components.Context) error {
Expand Down Expand Up @@ -137,18 +137,18 @@ func validateCreateAppVersionContext(ctx *components.Context) error {
func GetCreateAppVersionCommand(appContext app.Context) components.Command {
cmd := &createAppVersionCommand{versionService: appContext.GetVersionService()}
return components.Command{
Name: commands.CreateAppVersion,
Description: "Create application version",
Name: commands.VersionCreate,
Description: "Create application version.",
Category: common.CategoryVersion,
Aliases: []string{"vc"},
Arguments: []components.Argument{
{
Name: "version-name",
Description: "The name of the version",
Description: "The name of the version.",
Optional: false,
},
},
Flags: commands.GetCommandFlags(commands.CreateAppVersion),
Flags: commands.GetCommandFlags(commands.VersionCreate),
Action: cmd.prepareAndRunCommand,
}
}
Expand Down
12 changes: 6 additions & 6 deletions apptrust/commands/version/delete_app_version_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (dv *deleteAppVersionCommand) ServerDetails() (*coreConfig.ServerDetails, e
}

func (dv *deleteAppVersionCommand) CommandName() string {
return commands.DeleteAppVersion
return commands.VersionDelete
}

func (dv *deleteAppVersionCommand) prepareAndRunCommand(ctx *components.Context) error {
Expand All @@ -57,23 +57,23 @@ func (dv *deleteAppVersionCommand) prepareAndRunCommand(ctx *components.Context)
func GetDeleteAppVersionCommand(appContext app.Context) components.Command {
cmd := &deleteAppVersionCommand{versionService: appContext.GetVersionService()}
return components.Command{
Name: commands.DeleteAppVersion,
Description: "Delete application version",
Name: commands.VersionDelete,
Description: "Delete application version.",
Category: common.CategoryVersion,
Aliases: []string{"vd"},
Arguments: []components.Argument{
{
Name: "application-key",
Description: "The application key",
Description: "The application key.",
Optional: false,
},
{
Name: "version",
Description: "The name of the version to delete",
Description: "The name of the version to delete.",
Optional: false,
},
},
Flags: commands.GetCommandFlags(commands.DeleteAppVersion),
Flags: commands.GetCommandFlags(commands.VersionDelete),
Action: cmd.prepareAndRunCommand,
}
}
14 changes: 7 additions & 7 deletions apptrust/commands/version/promote_app_version_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (pv *promoteAppVersionCommand) ServerDetails() (*coreConfig.ServerDetails,
}

func (pv *promoteAppVersionCommand) CommandName() string {
return commands.PromoteAppVersion
return commands.VersionPromote
}

func (pv *promoteAppVersionCommand) prepareAndRunCommand(ctx *components.Context) error {
Expand Down Expand Up @@ -105,28 +105,28 @@ func (pv *promoteAppVersionCommand) buildRequestPayload(ctx *components.Context)
func GetPromoteAppVersionCommand(appContext app.Context) components.Command {
cmd := &promoteAppVersionCommand{versionService: appContext.GetVersionService()}
return components.Command{
Name: commands.PromoteAppVersion,
Description: "Promote application version",
Name: commands.VersionPromote,
Description: "Promote application version.",
Category: common.CategoryVersion,
Aliases: []string{"vp"},
Arguments: []components.Argument{
{
Name: "application-key",
Description: "The application key",
Description: "The application key.",
Optional: false,
},
{
Name: "version",
Description: "The version to promote",
Description: "The version to promote.",
Optional: false,
},
{
Name: "target-stage",
Description: "The target stage to which the application version should be promoted",
Description: "The target stage to which the application version should be promoted.",
Optional: false,
},
},
Flags: commands.GetCommandFlags(commands.PromoteAppVersion),
Flags: commands.GetCommandFlags(commands.VersionPromote),
Action: cmd.prepareAndRunCommand,
}
}
2 changes: 1 addition & 1 deletion apptrust/commands/version/promote_app_version_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,5 @@ func TestPromoteAppVersionCommand_CommandName(t *testing.T) {
defer ctrl.Finish()

cmd := &promoteAppVersionCommand{}
assert.Equal(t, commands.PromoteAppVersion, cmd.CommandName())
assert.Equal(t, commands.VersionPromote, cmd.CommandName())
}
5 changes: 3 additions & 2 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import (
// "apptrust",
// nil,
// components.Namespace{
// Name: "app",
// Name: "apptrust",
// Aliases: []string{"at"},
// Description: "AppTrust commands.",
// Category: "Command Namespaces",
// Commands: []components.Command{
Expand All @@ -37,7 +38,7 @@ import (
func GetJfrogCliApptrustApp() components.App {
appContext := app.NewAppContext()
appEntity := components.CreateApp(
"app",
"apptrust",
"1.0.5",
"JFrog AppTrust CLI",
[]components.Command{
Expand Down
Loading