func newUnscheduledPodsCommand(factory cmdutil.Factory, options JanitorOptions) *cobra.Command {
	o := newUnscheduledPodsOptions(options)
	cmd := &cobra.Command{
		Use:          "unscheduled",
		Short:        "List Pods that are in a pending state (waiting to be scheduled)",
		SilenceUsage: true,
		RunE: func(c *cobra.Command, args []string) error {
			if err := o.Complete(factory, c); err != nil {
				return err
			}
			ctx := context.Background()
			noHeader := c.Flag("no-headers").Changed
			if err := o.Run(ctx, noHeader); err != nil {
				fmt.Fprintln(options.Streams.ErrOut, err.Error())
				return nil
			}
			return nil
		},
	}
	o.ResourceBuilderFlags.AddFlags(cmd.Flags())
	return cmd
}
newUnscheduledPodsCommand returns a cobra command wrapping PendingPodsOptions.
package cmd
import (
	"bytes"
	"context"
	"fmt"
	"github.com/spf13/cobra"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	cmdutil "k8s.io/kubectl/pkg/cmd/util"
)
type UnscheduledPodsOptions struct {
	JanitorOptions
}
func newUnscheduledPodsOptions(options JanitorOptions) *UnscheduledPodsOptions {
	return &UnscheduledPodsOptions{
		JanitorOptions: options,
	}
}