//NewGetGroupCommand creates `groups get`
NewGetGroupCommand creates `groups get`
// NewGetGroupCommand creates ` groups get `
func NewGetGroupCommand() *cobra.Command {
	var (
		groupName     string
		namespaceOnly bool
	)
	cmd := &cobra.Command{
		Use:   "get",
		Short: "Get the group by provided name",
		Example: `
groups get --name=MyGroup
groups get --name=MyGroup --dataNamespaces
`,
		TraverseChildren: true,
		SilenceErrors:    true,
		RunE: func(cmd *cobra.Command, args []string) error {
			if err := bite.CheckRequiredFlags(cmd, bite.FlagPair{"name": groupName}); err != nil {
				return err
			}
			group, err := config.Client.GetGroup(groupName)
			if err != nil {
				golog.Errorf("Failed to find group. [%s]", err.Error())
				return err
			}
			if namespaceOnly {
				return bite.PrintObject(cmd, group.Namespaces)
			}
			return bite.PrintObject(cmd, group)
		},
	}
	cmd.Flags().StringVar(&groupName, "name", "", `Group name`)
	cmd.Flags().BoolVar(&namespaceOnly, "dataNamespaces", false, `Print data namespaces only`)
	bite.CanPrintJSON(cmd)
	return cmd
}
func NewGetGroupCommand ( ) * cobra . Command { var ( groupName string namespaceOnly bool ) cmd := & cobra . Command { Use : " " , Short : " " , Example : `
groups get --name=MyGroup
groups get --name=MyGroup --dataNamespaces
` , TraverseChildren : true , SilenceErrors : true , RunE : func ( cmd * cobra . Command , args [ ] string ) error { if err := bite . CheckRequiredFlags ( cmd , bite . FlagPair { " " : groupName } ) ; err != nil { return err } group , err := config . Client . GetGroup ( groupName ) if err != nil { golog . Errorf ( " " , err . Error ( ) ) return err } if namespaceOnly { return bite . PrintObject ( cmd , group . Namespaces ) } return bite . PrintObject ( cmd , group ) } , } cmd . Flags ( ) . StringVar ( & groupName , " " , " " , `Group name` ) cmd . Flags ( ) . BoolVar ( & namespaceOnly , " " , false , `Print data namespaces only` ) bite . CanPrintJSON ( cmd ) return cmd }
NewGetGroupCommand creates `groups get`
NewGetGroupCommand creates ` groups get `