ledo init
This commit is contained in:
@ -34,6 +34,11 @@ func InitCommand(ctx *cli.Context) *LedoContext {
|
||||
modeYml = ".jz-mode"
|
||||
}
|
||||
|
||||
if _, err := os.Stat(configYml); err != nil {
|
||||
fmt.Printf("Config file not found. Please run ledo init\n")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
mode := mode.InitMode(modeYml, configYml)
|
||||
c.Mode = mode
|
||||
|
||||
@ -56,6 +61,18 @@ func InitCommand(ctx *cli.Context) *LedoContext {
|
||||
return &c
|
||||
}
|
||||
|
||||
func LoadConfigFile() (*config.LedoFile, error) {
|
||||
configYml := ".ledo.yml"
|
||||
|
||||
if _, err := os.Stat(configYml); err != nil {
|
||||
nilCfg := &config.LedoFile{}
|
||||
return nilCfg, err
|
||||
}
|
||||
|
||||
cfg, _ := config.NewLedoFile(configYml)
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
func (lx *LedoContext) ExecCmd(cmd string, cmdArgs []string) error {
|
||||
fmt.Printf("Execute: %v %v\n", cmd, strings.Join(cmdArgs, " "))
|
||||
command := exec.Command(cmd, cmdArgs...)
|
||||
|
Reference in New Issue
Block a user