1
0
Fork 0
mirror of https://github.com/Luzifer/ansible-role-version.git synced 2024-12-23 02:51:20 +00:00
ansible-role-version/cmd/set.go

25 lines
471 B
Go
Raw Normal View History

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)
}