Skip to content

Commit

Permalink
Add categories to JFrog Artifactory commands (#2544)
Browse files Browse the repository at this point in the history
  • Loading branch information
sverdlov93 authored May 15, 2024
1 parent 01930cf commit 5b4aa73
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 36 deletions.
56 changes: 56 additions & 0 deletions artifactory/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,17 @@ import (
"github.com/urfave/cli"
)

const (
filesCategory = "Files Management"
buildCategory = "Build Info"
repoCategory = "Repository Management"
replicCategory = "Replication"
permCategory = "Permission Targets"
userCategory = "User Management"
transferCategory = "Transfer Between Artifactory Instances"
otherCategory = "Other"
)

func GetCommands() []cli.Command {
return cliutils.GetSortedCommands(cli.CommandsByName{
{
Expand All @@ -133,6 +144,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(upload.EnvVar...),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: uploadCmd,
Category: filesCategory,
},
{
Name: "download",
Expand All @@ -144,6 +156,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(download.EnvVar...),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: downloadCmd,
Category: filesCategory,
},
{
Name: "move",
Expand All @@ -155,6 +168,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(move.EnvVar),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: moveCmd,
Category: filesCategory,
},
{
Name: "copy",
Expand All @@ -166,6 +180,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(copydocs.EnvVar),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: copyCmd,
Category: filesCategory,
},
{
Name: "delete",
Expand All @@ -177,6 +192,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(delete.EnvVar),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: deleteCmd,
Category: filesCategory,
},
{
Name: "search",
Expand All @@ -188,6 +204,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(search.EnvVar),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: searchCmd,
Category: filesCategory,
},
{
Name: "set-props",
Expand All @@ -199,6 +216,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(setprops.EnvVar),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: setPropsCmd,
Category: filesCategory,
},
{
Name: "delete-props",
Expand All @@ -210,6 +228,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(deleteprops.EnvVar),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: deletePropsCmd,
Category: filesCategory,
},
{
Name: "build-publish",
Expand All @@ -221,6 +240,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: buildPublishCmd,
Category: buildCategory,
},
{
Name: "build-collect-env",
Expand All @@ -232,6 +252,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: buildCollectEnvCmd,
Category: buildCategory,
},
{
Name: "build-append",
Expand All @@ -243,6 +264,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: buildAppendCmd,
Category: buildCategory,
},
{
Name: "build-add-dependencies",
Expand All @@ -254,6 +276,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: buildAddDependenciesCmd,
Category: buildCategory,
},
{
Name: "build-add-git",
Expand All @@ -265,6 +288,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: buildAddGitCmd,
Category: buildCategory,
},
{
Name: "build-scan",
Expand All @@ -289,6 +313,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: buildCleanCmd,
Category: buildCategory,
},
{
Name: "build-promote",
Expand All @@ -300,6 +325,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: buildPromoteCmd,
Category: buildCategory,
},
{
Name: "build-discard",
Expand All @@ -311,6 +337,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: buildDiscardCmd,
Category: buildCategory,
},
{
Name: "git-lfs-clean",
Expand All @@ -322,6 +349,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: gitLfsCleanCmd,
Category: otherCategory,
},
{
Name: "mvn-config",
Expand Down Expand Up @@ -387,6 +415,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: dockerPromoteCmd,
Category: buildCategory,
},
{
Name: "docker-push",
Expand Down Expand Up @@ -428,6 +457,7 @@ func GetCommands() []cli.Command {
Action: func(c *cli.Context) error {
return containerPushCmd(c, containerutils.Podman)
},
Category: otherCategory,
},
{
Name: "podman-pull",
Expand All @@ -441,6 +471,7 @@ func GetCommands() []cli.Command {
Action: func(c *cli.Context) error {
return containerPullCmd(c, containerutils.Podman)
},
Category: otherCategory,
},
{
Name: "build-docker-create",
Expand All @@ -452,6 +483,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: BuildDockerCreateCmd,
Category: buildCategory,
},
{
Name: "oc", // Only 'oc start-build' is supported
Expand All @@ -463,6 +495,7 @@ func GetCommands() []cli.Command {
SkipFlagParsing: true,
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: ocStartBuildCmd,
Category: otherCategory,
},
{
Name: "npm-config",
Expand Down Expand Up @@ -582,6 +615,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: nugetDepsTreeCmd,
Category: otherCategory,
},
{
Name: "dotnet-config",
Expand Down Expand Up @@ -709,6 +743,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: repoTemplateCmd,
Category: repoCategory,
},
{
Name: "repo-create",
Expand All @@ -720,6 +755,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: repoCreateCmd,
Category: repoCategory,
},
{
Name: "repo-update",
Expand All @@ -731,6 +767,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: repoUpdateCmd,
Category: repoCategory,
},
{
Name: "repo-delete",
Expand All @@ -742,6 +779,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: repoDeleteCmd,
Category: repoCategory,
},
{
Name: "replication-template",
Expand All @@ -753,6 +791,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: replicationTemplateCmd,
Category: replicCategory,
},
{
Name: "replication-create",
Expand All @@ -764,6 +803,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: replicationCreateCmd,
Category: replicCategory,
},
{
Name: "replication-delete",
Expand All @@ -775,6 +815,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: replicationDeleteCmd,
Category: replicCategory,
},
{
Name: "permission-target-template",
Expand All @@ -785,6 +826,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: permissionTargetTemplateCmd,
Category: permCategory,
},
{
Name: "permission-target-create",
Expand All @@ -796,6 +838,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: permissionTargetCreateCmd,
Category: permCategory,
},
{
Name: "permission-target-update",
Expand All @@ -807,6 +850,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: permissionTargetUpdateCmd,
Category: permCategory,
},
{
Name: "permission-target-delete",
Expand All @@ -818,6 +862,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: permissionTargetDeleteCmd,
Category: permCategory,
},
{
Name: "user-create",
Expand All @@ -827,6 +872,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: userCreateCmd,
Category: userCategory,
},
{
Name: "users-create",
Expand All @@ -837,6 +883,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: usersCreateCmd,
Category: userCategory,
},
{
Name: "users-delete",
Expand All @@ -848,6 +895,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: usersDeleteCmd,
Category: userCategory,
},
{
Name: "group-create",
Expand All @@ -859,6 +907,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: groupCreateCmd,
Category: userCategory,
},
{
Name: "group-add-users",
Expand All @@ -870,6 +919,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: groupAddUsersCmd,
Category: userCategory,
},
{
Name: "group-delete",
Expand All @@ -881,6 +931,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: groupDeleteCmd,
Category: userCategory,
},
{
Name: "access-token-create",
Expand All @@ -903,6 +954,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: transferSettingsCmd,
Category: transferCategory,
},
{
Name: "transfer-config",
Expand All @@ -913,6 +965,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: transferConfigCmd,
Category: transferCategory,
},
{
Name: "transfer-config-merge",
Expand All @@ -923,6 +976,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: transferConfigMergeCmd,
Category: transferCategory,
},
{
Name: "transfer-files",
Expand All @@ -933,6 +987,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: transferFilesCmd,
Category: transferCategory,
},
{
Name: "transfer-plugin-install",
Expand All @@ -943,6 +998,7 @@ func GetCommands() []cli.Command {
ArgsUsage: common.CreateEnvVars(),
BashComplete: corecommon.CreateBashCompletionFunc(),
Action: dataTransferPluginInstallCmd,
Category: transferCategory,
},
})
}
Expand Down
Loading

0 comments on commit 5b4aa73

Please sign in to comment.