From a8ba77f23b793897f037ba61efa53a9ed6dc339d Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Sat, 21 Feb 2015 18:25:55 -0500 Subject: [PATCH] Remove unused flag helpers --- pkg/kubectl/cmd/util/helpers.go | 48 --------------------------------- 1 file changed, 48 deletions(-) diff --git a/pkg/kubectl/cmd/util/helpers.go b/pkg/kubectl/cmd/util/helpers.go index a2c2b485497..497403a1cb3 100644 --- a/pkg/kubectl/cmd/util/helpers.go +++ b/pkg/kubectl/cmd/util/helpers.go @@ -22,7 +22,6 @@ import ( "io/ioutil" "net/http" "os" - "path/filepath" "strconv" "strings" "time" @@ -66,26 +65,6 @@ func GetFlagBool(cmd *cobra.Command, flag string) bool { return false } -// Returns nil if the flag wasn't set. -func GetFlagBoolPtr(cmd *cobra.Command, flag string) *bool { - f := cmd.Flags().Lookup(flag) - if f == nil { - glog.Fatalf("Flag accessed but not defined for command %s: %s", cmd.Name(), flag) - } - // Check if flag was not set at all. - if !f.Changed && f.DefValue == f.Value.String() { - return nil - } - var ret bool - // Caseless compare. - if strings.ToLower(f.Value.String()) == "true" { - ret = true - } else { - ret = false - } - return &ret -} - // Assumes the flag has a default value. func GetFlagInt(cmd *cobra.Command, flag string) int { f := cmd.Flags().Lookup(flag) @@ -109,33 +88,6 @@ func GetFlagDuration(cmd *cobra.Command, flag string) time.Duration { return v } -// Returns the first non-empty string out of the ones provided. If all -// strings are empty, returns an empty string. -func FirstNonEmptyString(args ...string) string { - for _, s := range args { - if len(s) > 0 { - return s - } - } - return "" -} - -// Return a list of file names of a certain type within a given directory. -// TODO: replace with resource.Builder -func GetFilesFromDir(directory string, fileType string) []string { - files := []string{} - - err := filepath.Walk(directory, func(path string, f os.FileInfo, err error) error { - if filepath.Ext(path) == fileType { - files = append(files, path) - } - return err - }) - - checkErr(err) - return files -} - // ReadConfigData reads the bytes from the specified filesytem or network // location or from stdin if location == "-". // TODO: replace with resource.Builder