Skip to content

Commit

Permalink
Manifest init updates existing and print exec cmd if verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
saheljalal committed Aug 29, 2019
1 parent 4ed2f1d commit 5ff5ad9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion config/config.go
Expand Up @@ -12,7 +12,7 @@ import (
)

// ConfigPath for standard nostromo config
var ConfigPath = "~/.nostromo/config"
const ConfigPath = "~/.nostromo/config"

// Config manages working with nostromo configuration files
// The file format is JSON this just provides convenience around converting
Expand Down
24 changes: 14 additions & 10 deletions task/task.go
Expand Up @@ -12,16 +12,16 @@ import (

// InitConfig of nostromo config file if not already initialized
func InitConfig() {
cfg := config.NewConfig(config.ConfigPath, model.NewManifest())
if cfg.Exists() {
fmt.Println("nostromo config already exists")
return
}

err := pathutil.EnsurePath("~/.nostromo")
if err != nil {
fmt.Println(err)
return
cfg := checkConfig()
if cfg == nil {
cfg = config.NewConfig(config.ConfigPath, model.NewManifest())
err := pathutil.EnsurePath("~/.nostromo")
if err != nil {
fmt.Println(err)
return
}
} else {
fmt.Println("nostromo config already exists, updating")
}

saveConfig(cfg)
Expand Down Expand Up @@ -158,6 +158,10 @@ func Run(args []string) {
return
}

if cfg.Manifest.Config.Verbose {
fmt.Println("executing:", cmd)
}

err = shell.Run(cmd)
if err != nil {
fmt.Println(err)
Expand Down

0 comments on commit 5ff5ad9

Please sign in to comment.