try wait
This commit is contained in:
parent
c41f2efec7
commit
86b6a0d52b
2 changed files with 15 additions and 18 deletions
|
|
@ -1,7 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
|
@ -41,22 +41,23 @@ func deleteAllExceptTemplate(outPath string, excludeDir string) {
|
|||
|
||||
func main() {
|
||||
cwd, _ := os.Getwd()
|
||||
var outPath string
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
fmt.Print("What should we call your new app? Enter name: ")
|
||||
outPath, _ = reader.ReadString('\n')
|
||||
outPath = strings.ReplaceAll(outPath, "\n", "")
|
||||
outPath = strings.ReplaceAll(outPath, " ", "-")
|
||||
outPath = strings.ToLower(outPath)
|
||||
|
||||
if outPath == "" {
|
||||
outPath := flag.String("out", "", "Specify the output path for the new app")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
*outPath = strings.ReplaceAll(*outPath, "\n", "")
|
||||
*outPath = strings.ReplaceAll(*outPath, " ", "-")
|
||||
*outPath = strings.ToLower(*outPath)
|
||||
|
||||
if *outPath == "" {
|
||||
fmt.Println("Please provide a name for your app.")
|
||||
return
|
||||
}
|
||||
|
||||
excludeDir := "starter-template"
|
||||
|
||||
install := exec.Command("git", "clone", "https://github.com/maddalax/mhtml", "--depth=1", outPath)
|
||||
install := exec.Command("git", "clone", "https://github.com/maddalax/mhtml", "--depth=1", *outPath)
|
||||
install.Stdout = os.Stdout
|
||||
install.Stderr = os.Stderr
|
||||
err := install.Run()
|
||||
|
|
@ -66,9 +67,9 @@ func main() {
|
|||
return
|
||||
}
|
||||
|
||||
deleteAllExceptTemplate(outPath, excludeDir)
|
||||
deleteAllExceptTemplate(*outPath, excludeDir)
|
||||
|
||||
newDir := filepath.Join(cwd, outPath)
|
||||
newDir := filepath.Join(cwd, *outPath)
|
||||
|
||||
mvCmd := exec.Command("cp", "-vaR", fmt.Sprintf("%s/.", excludeDir), ".")
|
||||
mvCmd.Dir = newDir
|
||||
|
|
|
|||
|
|
@ -4,15 +4,11 @@ interval: 500ms
|
|||
|
||||
tasks:
|
||||
|
||||
template2:
|
||||
template:
|
||||
dir: '{{.USER_WORKING_DIR}}'
|
||||
desc: Generate template from source code
|
||||
cmds:
|
||||
- |
|
||||
echo "Type value of FOO:"
|
||||
read FOO;
|
||||
echo "You said: ${FOO}";
|
||||
- go run github.com/maddalax/mhtml/framework/tooling/downloadtemplate@latest
|
||||
- go run github.com/maddalax/mhtml/framework/tooling/downloadtemplate@latest -out my-app
|
||||
|
||||
setup:
|
||||
deps: [copy-framework-assets, ast]
|
||||
|
|
|
|||
Loading…
Reference in a new issue