feat: add cli flags

This commit is contained in:
 Ilya Atamas
2019-04-21 18:30:04 +03:00
parent 6abde80d35
commit e5b40a79ea
11 changed files with 193 additions and 152 deletions

25
cli/utils.go Normal file
View File

@@ -0,0 +1,25 @@
package cli
import (
"os"
"strconv"
)
func getEnvString(env string, def string) string {
value := os.Getenv(env)
if value != "" {
return value
} else {
return def
}
}
func getEnvInt(env string, def string) int {
value := getEnvString(env, def)
// TODO: handle error
converted, _ := strconv.Atoi(value)
return converted
}