Skip to content

Commit e347a2c

Browse files
committed
Added create version command
1 parent 5616e2b commit e347a2c

File tree

4 files changed

+72
-1
lines changed

4 files changed

+72
-1
lines changed

application/cli/cli.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package cli
22

33
import (
4+
"github.com/jfrog/jfrog-cli-application/application/commands/system"
5+
"github.com/jfrog/jfrog-cli-application/application/commands/version"
46
"github.com/jfrog/jfrog-cli-core/v2/plugins/components"
57
)
68

@@ -14,7 +16,10 @@ func GetJfrogApplicationCli() components.App {
1416
Name: "app",
1517
Description: "Tools for Application Lifecycle management",
1618
Category: category,
17-
Commands: []components.Command{},
19+
Commands: []components.Command{
20+
system.GetPingCommand(),
21+
version.GetCreateVersionCommand(),
22+
},
1823
},
1924
)
2025
return app
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package system
2+
3+
import (
4+
"github.com/jfrog/jfrog-cli-application/application/common"
5+
"github.com/jfrog/jfrog-cli-core/v2/plugins/components"
6+
)
7+
8+
type pingCommand struct {
9+
ctx *components.Context
10+
}
11+
12+
func (pc *pingCommand) executeCmd(ctx *components.Context) error {
13+
return ctx.PrintCommandHelp(ctx.CommandName)
14+
}
15+
16+
func GetPingCommand() components.Command {
17+
return components.Command{
18+
Name: "ping",
19+
Description: "Ping the application server",
20+
Category: common.CategorySystem,
21+
Aliases: []string{"p"},
22+
Arguments: []components.Argument{},
23+
Flags: []components.Flag{},
24+
EnvVars: []components.EnvVar{},
25+
Action: func(c *components.Context) error {
26+
cmd := &pingCommand{ctx: c}
27+
return cmd.executeCmd(c)
28+
},
29+
}
30+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package version
2+
3+
import (
4+
"github.com/jfrog/jfrog-cli-application/application/common"
5+
"github.com/jfrog/jfrog-cli-core/v2/plugins/components"
6+
)
7+
8+
type createVersionCommand struct {
9+
ctx *components.Context
10+
}
11+
12+
func (cv *createVersionCommand) executeCmd(ctx *components.Context) error {
13+
return ctx.PrintCommandHelp(ctx.CommandName)
14+
}
15+
16+
func GetCreateVersionCommand() components.Command {
17+
return components.Command{
18+
Name: "create-version",
19+
Description: "Create application version",
20+
Category: common.CategoryVersion,
21+
Aliases: []string{"cv"},
22+
Arguments: []components.Argument{},
23+
Flags: []components.Flag{},
24+
EnvVars: []components.EnvVar{},
25+
Action: func(c *components.Context) error {
26+
cmd := &createVersionCommand{ctx: c}
27+
return cmd.executeCmd(c)
28+
},
29+
}
30+
}

application/common/categories.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package common
2+
3+
const (
4+
CategorySystem = "system"
5+
CategoryVersion = "version"
6+
)

0 commit comments

Comments
 (0)