ledo init
This commit is contained in:
40
app/cmd/init.go
Normal file
40
app/cmd/init.go
Normal file
@ -0,0 +1,40 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/urfave/cli/v2"
|
||||
"html/template"
|
||||
"ledo/app/modules/context"
|
||||
"ledo/app/modules/interact"
|
||||
"ledo/app/templates"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
var CmdInit = cli.Command{
|
||||
Name: "init",
|
||||
Aliases: []string{"i"},
|
||||
Category: catSetup,
|
||||
Usage: "Init ledo in project",
|
||||
Description: `Initialize LeadDocker in current project`,
|
||||
Action: runInitLedo,
|
||||
}
|
||||
|
||||
func runInitLedo(cmd *cli.Context) error {
|
||||
config, _ := context.LoadConfigFile()
|
||||
data, err := interact.InitLedoProject(config.Docker)
|
||||
tpl, err := template.New("tpl").Parse(templates.LedoConfigurationFileTemplate)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
err = tpl.Execute(os.Stdout, data)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
advRun := interact.InitAdvancedConfigurationAsk()
|
||||
fmt.Printf("%v", advRun)
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ func RunSelectMode(cmd *cli.Context) error {
|
||||
ctx.Mode.SetMode(cmd.Args().First())
|
||||
return nil
|
||||
}
|
||||
// interact.SelectDockerHubTag("paramah/php")
|
||||
interact.SelectMode(ctx, "")
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user