Documentation ¶
Index ¶
- Constants
- Variables
- func CopyTemplate(srcPath, dstPath string, data map[string]interface{}) error
- func DetectContentTypeByBody(r io.Reader) (contentType string)
- func DetectContentTypeByExt(path string) (contentType string)
- func FindAppDir() (string, error)
- func FindEnv() (map[string]string, error)
- func GenerateRandomKey(length int) []byte
- func GoString(i interface{}) string
- func Gunzip(gz string) string
- func Gzip(raw string) string
- func IsUnexportedField(field reflect.StructField) bool
- func NormPath(p string) string
- func PanicOnError(usager usager, format string, a ...interface{})
- func PrintBlue(s string, a ...interface{})
- func PrintConflict(path string)
- func PrintCreate(path string)
- func PrintCreateDirectory(path string)
- func PrintCyan(s string, a ...interface{})
- func PrintEnv() error
- func PrintExist(path string)
- func PrintGreen(s string, a ...interface{})
- func PrintIdentical(path string)
- func PrintMagenta(s string, a ...interface{})
- func PrintOverwrite(path string)
- func PrintRed(s string, a ...interface{})
- func PrintSkip(path string)
- func PrintYellow(s string, a ...interface{})
- func RunCommand(cmd Commander)
- func SplitExt(path string) (name, ext string)
- func ToCamelCase(s string) string
- func ToSnakeCase(s string) string
- type Commander
- type Error
Constants ¶
const (
TemplateSuffix = ".tmpl"
)
Variables ¶
Functions ¶
func CopyTemplate ¶
func DetectContentTypeByBody ¶
Get Content-Type by content body
func DetectContentTypeByExt ¶
Get Content-Type by extension of filename.
func FindAppDir ¶
FindAppDir returns application directory. (aka import path) An application directory retrieves from current working directory. For example, if current working directory is "/path/to/gopath/src/github.com/naoina/myapp", FindAppDir returns "github.com/naoina/myapp".
func FindEnv ¶ added in v0.7.0
FindEnv returns map of environment variables. Key of map is key of environment variable, Value of map is value of environment variable.
func GoString ¶
func GoString(i interface{}) string
GoString returns Go-syntax representation of the value. It returns compilable Go-syntax that different with "%#v" format for fmt package.
func IsUnexportedField ¶
func IsUnexportedField(field reflect.StructField) bool
IsUnexportedField returns whether the field is unexported. This function is to avoid the bug in versions older than Go1.3. See following links:
https://code.google.com/p/go/issues/detail?id=7247 http://golang.org/ref/spec#Exported_identifiers
func PanicOnError ¶
func PanicOnError(usager usager, format string, a ...interface{})
func PrintConflict ¶
func PrintConflict(path string)
func PrintCreate ¶
func PrintCreate(path string)
func PrintCreateDirectory ¶
func PrintCreateDirectory(path string)
func PrintExist ¶
func PrintExist(path string)
func PrintGreen ¶
func PrintGreen(s string, a ...interface{})
func PrintIdentical ¶
func PrintIdentical(path string)
func PrintMagenta ¶
func PrintMagenta(s string, a ...interface{})
func PrintOverwrite ¶
func PrintOverwrite(path string)
func PrintYellow ¶
func PrintYellow(s string, a ...interface{})
func RunCommand ¶
func RunCommand(cmd Commander)
func SplitExt ¶
SplitExt returns pair of file name and extension.
It will truncated a dot of extension. e.g. When the given path is "path/to/image.png", SplitExt returns ("path/to/image", "png").