Some changes in const vars of the app

This commit is contained in:
Daniele Conventi 2016-08-23 15:17:44 +02:00
parent e735ae0959
commit cc568010ee
2 changed files with 11 additions and 17 deletions

13
main.go
View File

@ -10,7 +10,7 @@ import (
func main() { func main() {
app := r.Init() app := r.Info()
handle := func(err error) error { handle := func(err error) error {
if err != nil { if err != nil {
@ -21,7 +21,8 @@ func main() {
} }
header := func() error { header := func() error {
app.Information() fmt.Println(r.Blue(app.Name) + " - " + r.Blue(app.Version))
fmt.Println(r.BlueS(app.Description) + "\n")
gopath := os.Getenv("GOPATH") gopath := os.Getenv("GOPATH")
if gopath == "" { if gopath == "" {
log.Fatal(r.Red("$GOPATH isn't set up properly")) log.Fatal(r.Red("$GOPATH isn't set up properly"))
@ -34,8 +35,12 @@ func main() {
Version: app.Version, Version: app.Version,
Authors: []*cli.Author{ Authors: []*cli.Author{
{ {
Name: app.Author, Name: "Alessio Pracchia",
Email: app.Email, Email: "pracchia@hastega.it",
},
{
Name: "Daniele Conventi",
Email: "conventi@hastega.it",
}, },
}, },
Usage: app.Description, Usage: app.Description,

View File

@ -13,9 +13,7 @@ import (
const ( const (
AppName = "Realize" AppName = "Realize"
AppVersion = "v1.0" AppVersion = "v1.0"
AppEmail = "pracchia@hastega.it" AppDescription = "A Golang build system with file watchers, output streams and live reload. Run, build and watch file changes with custom paths\n"
AppDescription = "Run, install or build your applications on file changes. Output preview and multi project support"
AppAuthor = "Alessio Pracchia"
AppFile = "realize.config.yaml" AppFile = "realize.config.yaml"
) )
@ -74,23 +72,14 @@ func init() {
} }
} }
// Init is an instance of app with default values func Info() *App {
func Init() *App {
return &App{ return &App{
Name: AppName, Name: AppName,
Version: AppVersion, Version: AppVersion,
Description: AppDescription, Description: AppDescription,
Author: AppAuthor,
Email: AppEmail,
} }
} }
// Information print realize name and description
func (app *App) Information() {
fmt.Println(Blue(app.Name) + " - " + Blue(app.Version))
fmt.Println(BlueS(app.Description) + "\n")
}
// Cewrites the log timestamp // Cewrites the log timestamp
func (writer logWriter) Write(bytes []byte) (int, error) { func (writer logWriter) Write(bytes []byte) (int, error) {
return fmt.Print(YellowS("[") + time.Now().Format("15:04:05") + YellowS("]") + string(bytes)) return fmt.Print(YellowS("[") + time.Now().Format("15:04:05") + YellowS("]") + string(bytes))