Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
(GH-16) Add prm set base command
Browse files Browse the repository at this point in the history
This commit adds the base `prm set` command. This command will
simply output the help function for `prm set` when invoked.
  • Loading branch information
sanfrancrisko committed Nov 9, 2021
1 parent 8b7c69f commit aa2bef2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
24 changes: 24 additions & 0 deletions cmd/set/set.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package set

import (
"fmt"

"github.com/spf13/cobra"
)

const (
PUPPET string = "puppet"
)

func CreateSetCommand() *cobra.Command {
tmp := &cobra.Command{
Use: fmt.Sprintf("set %s [args]", PUPPET),
Short: "Sets the specified configuration to the specified value",
Long: "Sets the specified configuration to the specified value",
ValidArgs: []string{PUPPET},
Run: func(cmd *cobra.Command, args []string) {
cmd.HelpFunc()(cmd, args)
},
}
return tmp
}
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/puppetlabs/pdkgo/pkg/telemetry"
"github.com/puppetlabs/prm/cmd/root"
"github.com/puppetlabs/prm/cmd/set"
appver "github.com/puppetlabs/prm/cmd/version"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -37,6 +38,9 @@ func main() {
rootCmd.SetVersionTemplate(v)
rootCmd.AddCommand(verCmd)

// set command
rootCmd.AddCommand(set.CreateSetCommand())

// initialize
cobra.OnInitialize(root.InitLogger, root.InitConfig)

Expand Down

0 comments on commit aa2bef2

Please sign in to comment.