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
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
|
@ -41,22 +41,23 @@ func deleteAllExceptTemplate(outPath string, excludeDir string) {
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
cwd, _ := os.Getwd()
|
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.")
|
fmt.Println("Please provide a name for your app.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
excludeDir := "starter-template"
|
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.Stdout = os.Stdout
|
||||||
install.Stderr = os.Stderr
|
install.Stderr = os.Stderr
|
||||||
err := install.Run()
|
err := install.Run()
|
||||||
|
|
@ -66,9 +67,9 @@ func main() {
|
||||||
return
|
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 := exec.Command("cp", "-vaR", fmt.Sprintf("%s/.", excludeDir), ".")
|
||||||
mvCmd.Dir = newDir
|
mvCmd.Dir = newDir
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,11 @@ interval: 500ms
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
template2:
|
template:
|
||||||
dir: '{{.USER_WORKING_DIR}}'
|
dir: '{{.USER_WORKING_DIR}}'
|
||||||
desc: Generate template from source code
|
desc: Generate template from source code
|
||||||
cmds:
|
cmds:
|
||||||
- |
|
- go run github.com/maddalax/mhtml/framework/tooling/downloadtemplate@latest -out my-app
|
||||||
echo "Type value of FOO:"
|
|
||||||
read FOO;
|
|
||||||
echo "You said: ${FOO}";
|
|
||||||
- go run github.com/maddalax/mhtml/framework/tooling/downloadtemplate@latest
|
|
||||||
|
|
||||||
setup:
|
setup:
|
||||||
deps: [copy-framework-assets, ast]
|
deps: [copy-framework-assets, ast]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue