1
0
Fork 0
mirror of https://github.com/Luzifer/ansible-role-version.git synced 2024-10-18 12:54:22 +00:00
ansible-role-version/cmd/set.go
Knut Ahlers 2db953925e
Migrate to cobra to support more future commands
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2018-01-11 00:02:48 +01:00

24 lines
471 B
Go

package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
// setCmd represents the set command
var setCmd = &cobra.Command{
Use: "set <role> <version>",
Short: "Set the version of a role statically",
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) != 2 {
return fmt.Errorf("You must specify role and version")
}
return patchRoleFile(cfg.RolesFile, map[string]string{args[0]: args[1]})
},
}
func init() {
RootCmd.AddCommand(setCmd)
}