|
|
|
@ -1,12 +1,14 @@ |
|
|
|
|
package utils |
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
"path/filepath" |
|
|
|
|
"flag" |
|
|
|
|
"fmt" |
|
|
|
|
"os" |
|
|
|
|
"strings" |
|
|
|
|
"os/user" |
|
|
|
|
"path/filepath" |
|
|
|
|
"strings" |
|
|
|
|
|
|
|
|
|
"github.com/codegangsta/cli" |
|
|
|
|
"flag" |
|
|
|
|
"fmt" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
// Custom type which is registered in the flags library which cli uses for
|
|
|
|
@ -55,6 +57,7 @@ func eachName(longName string, fn func(string)) { |
|
|
|
|
fn(name) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// called by cli library, grabs variable from environment (if in env)
|
|
|
|
|
// and adds variable to flag set for parsing.
|
|
|
|
|
func (self DirectoryFlag) Apply(set *flag.FlagSet) { |
|
|
|
@ -69,7 +72,7 @@ func (self DirectoryFlag) Apply(set *flag.FlagSet) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
eachName(self.Name, func(name string) { |
|
|
|
|
set.Var(self.Value, self.Name, "a: " + self.Usage) |
|
|
|
|
set.Var(self.Value, self.Name, "a: "+self.Usage) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
@ -128,6 +131,3 @@ func expandPath(p string) string { |
|
|
|
|
|
|
|
|
|
return filepath.Clean(os.ExpandEnv(p)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|