Skip to content

Commit

Permalink
cobra aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-mccoy committed Feb 8, 2022
1 parent 1dfbf07 commit c77533d
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 16 deletions.
5 changes: 3 additions & 2 deletions cli/cmd/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ var (
connectRemotePort int

connectCmd = &cobra.Command{
Use: "connect <REGISTRY|LOGGING|GIT>",
Short: "Access services or pods deployed in the cluster.",
Use: "connect <REGISTRY|LOGGING|GIT>",
Aliases: []string{"c"},
Short: "Access services or pods deployed in the cluster.",
Run: func(cmd *cobra.Command, args []string) {
var target string
if len(args) > 0 {
Expand Down
5 changes: 3 additions & 2 deletions cli/cmd/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ var confirmDestroy bool
var removeComponents bool

var destroyCmd = &cobra.Command{
Use: "destroy",
Short: "Tear it all down, we'll miss you Zarf...",
Use: "destroy",
Aliases: []string{"d"},
Short: "Tear it all down, we'll miss you Zarf...",
Run: func(cmd *cobra.Command, args []string) {
state := k8s.LoadZarfState()
_ = os.Remove(".zarf-registry")
Expand Down
7 changes: 4 additions & 3 deletions cli/cmd/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import (

// initCmd represents the init command
var initCmd = &cobra.Command{
Use: "init",
Short: "Deploys the gitops service or appliance cluster on a clean linux box",
Long: "Flags are only required if running via automation, otherwise the init command will prompt you for your configuration choices",
Use: "init",
Aliases: []string{"i"},
Short: "Deploys the gitops service or appliance cluster on a clean linux box",
Long: "Flags are only required if running via automation, otherwise the init command will prompt you for your configuration choices",
Run: func(cmd *cobra.Command, args []string) {
zarfLogo := getLogo()
_, _ = fmt.Fprintln(os.Stderr, zarfLogo)
Expand Down
5 changes: 3 additions & 2 deletions cli/cmd/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ var insecureDeploy bool
var shasum string

var packageCmd = &cobra.Command{
Use: "package",
Short: "Pack and unpack updates for the Zarf gitops service.",
Use: "package",
Aliases: []string{"p"},
Short: "Pack and unpack updates for the Zarf gitops service.",
}

var packageCreateCmd = &cobra.Command{
Expand Down
11 changes: 8 additions & 3 deletions cli/cmd/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/spf13/cobra"
)

var repoHelmChartPath string
var prepareCmd = &cobra.Command{
Use: "prepare",
Short: "Tools to help prepare assets for packaging",
Expand Down Expand Up @@ -68,10 +69,11 @@ var prepareComputeFileSha256sum = &cobra.Command{
}

var prepareFindImages = &cobra.Command{
Use: "find-images",
Short: "evaluates components in a zarf file to identify images specified in their helm charts and manifests",
Use: "find-images",
Aliases: []string{"prep"},
Short: "evaluates components in a zarf file to identify images specified in their helm charts and manifests",
Run: func(cmd *cobra.Command, args []string) {
packager.FindImages()
packager.FindImages(repoHelmChartPath)
},
}

Expand All @@ -80,4 +82,7 @@ func init() {
prepareCmd.AddCommand(prepareTransformGitLinks)
prepareCmd.AddCommand(prepareComputeFileSha256sum)
prepareCmd.AddCommand(prepareFindImages)

prepareFindImages.Flags().StringVarP(&repoHelmChartPath, "repo-chart-path", "p", "", `If git repos hold helm charts, often found with gitops tools, specify the chart path, e.g. "/" or "/chart"`)

}
5 changes: 3 additions & 2 deletions cli/cmd/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ import (
)

var toolsCmd = &cobra.Command{
Use: "tools",
Short: "Collection of additional tools to make airgap easier",
Use: "tools",
Aliases: []string{"t"},
Short: "Collection of additional tools to make airgap easier",
}

// destroyCmd represents the init command
Expand Down
5 changes: 3 additions & 2 deletions cli/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import (
)

var versionCmd = &cobra.Command{
Use: "version",
Short: "Displays the version the zarf binary was built from",
Use: "version",
Aliases: []string{"v"},
Short: "Displays the version the zarf binary was built from",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(config.CLIVersion)
},
Expand Down

0 comments on commit c77533d

Please sign in to comment.