Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
pefish committed Nov 7, 2023
1 parent 5aa421b commit b4bd01d
Show file tree
Hide file tree
Showing 15 changed files with 92 additions and 34 deletions.
11 changes: 8 additions & 3 deletions cmd/create-app/command/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package command
import (
"flag"
"fmt"
"os"
"os/exec"
"strings"

"github.com/pefish/create-app/pkg/global"
"github.com/pefish/create-app/pkg/templates"
"github.com/pefish/go-commander"
go_config "github.com/pefish/go-config"
go_logger "github.com/pefish/go-logger"
go_shell "github.com/pefish/go-shell"
"strings"
)

type DefaultCommand struct {
Expand Down Expand Up @@ -104,7 +106,10 @@ git remote add origin %s
params.ProjectName,
params.RepoUrl,
)
err = go_shell.NewCmd(script).Run()
cmd := exec.Command("bash", "-c", script)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err = cmd.Run()
if err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ require (
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pefish/go-reflect v0.2.2 // indirect
github.com/pefish/go-shell v0.0.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
go.uber.org/atomic v1.5.0 // indirect
go.uber.org/multierr v1.3.0 // indirect
Expand Down
6 changes: 0 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ github.com/pefish/go-logger v0.4.16 h1:PpqYr4xGO6nmQQsNVo2zpnvfIvzhPOyrFjMfQFUWn
github.com/pefish/go-logger v0.4.16/go.mod h1:IN1qdbxaVfsT518o9lsj8YY0bCi6E8kakuiVzG6pICA=
github.com/pefish/go-reflect v0.2.2 h1:rNYU5mMIouRaZyAjDt2/rooNm0zx2IaRBa344Bq1s9o=
github.com/pefish/go-reflect v0.2.2/go.mod h1:J1PmxXVMl+IqyzuL1OndaKqZjkvfKLaZA9LpUCUB99c=
github.com/pefish/go-shell v0.0.1 h1:zBZ//czNRs3ltIhT0N86m1Ht9VmL6DhPiVJdURxuKsc=
github.com/pefish/go-shell v0.0.1/go.mod h1:YxAXo2ZtsbHcdU6IeCgJDIwh2sRVdCAoQSzBO9hLLHY=
github.com/pefish/go-shell v0.0.2 h1:SuHT7rm1IZE4su/ji60u7JP//mTGBS2eB7VjWe6w/0w=
github.com/pefish/go-shell v0.0.2/go.mod h1:YxAXo2ZtsbHcdU6IeCgJDIwh2sRVdCAoQSzBO9hLLHY=
github.com/pefish/go-shell v0.0.4 h1:TJdOAjWZsty7vrbhgJ+u3q6jAYpZ93T5p8HlJoYdp+g=
github.com/pefish/go-shell v0.0.4/go.mod h1:YxAXo2ZtsbHcdU6IeCgJDIwh2sRVdCAoQSzBO9hLLHY=
github.com/pefish/go-test-assert v0.0.1 h1:zWV2Hnn/Rtjf+bEOlyB8qF9ThJb7gmXpRPWEqJtjzjg=
github.com/pefish/go-test-assert v0.0.1/go.mod h1:kfcsv5ag411u06gdV4iRKU8D0zOglian/DBacnCoQdc=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down
9 changes: 7 additions & 2 deletions pkg/templates/electron.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package templates

import (
"fmt"
"os"
"os/exec"

"github.com/pefish/create-app/pkg/global"
go_shell "github.com/pefish/go-shell"
)

type ElectronTemplate struct {
Expand Down Expand Up @@ -43,7 +45,10 @@ cp config/sample.yaml config/local.yaml
params.ProjectName,
params.ProjectName,
)
err := go_shell.NewCmd(script).Run()
cmd := exec.Command("bash", "-c", script)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
return err
}
Expand Down
9 changes: 7 additions & 2 deletions pkg/templates/go_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package templates

import (
"fmt"
"os"
"os/exec"

"github.com/pefish/create-app/pkg/global"
go_shell "github.com/pefish/go-shell"
)

type GoAppTemplate struct {
Expand Down Expand Up @@ -37,7 +39,10 @@ rm -rf ./init.sh
params.ProjectName,
params.ProjectName,
)
err := go_shell.NewCmd(script).Run()
cmd := exec.Command("bash", "-c", script)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
return err
}
Expand Down
9 changes: 7 additions & 2 deletions pkg/templates/go_grpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package templates

import (
"fmt"
"os"
"os/exec"

"github.com/pefish/create-app/pkg/global"
go_shell "github.com/pefish/go-shell"
)

type GoGrpcServerTemplate struct {
Expand Down Expand Up @@ -37,7 +39,10 @@ rm -rf ./init.sh
params.ProjectName,
params.ProjectName,
)
err := go_shell.NewCmd(script).Run()
cmd := exec.Command("bash", "-c", script)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
return err
}
Expand Down
9 changes: 7 additions & 2 deletions pkg/templates/go_lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package templates

import (
"fmt"
"os"
"os/exec"

"github.com/pefish/create-app/pkg/global"
go_shell "github.com/pefish/go-shell"
)

type GoLibTemplate struct {
Expand Down Expand Up @@ -37,7 +39,10 @@ rm -rf ./init.sh
params.ProjectName,
params.PackageName,
)
err := go_shell.NewCmd(script).Run()
cmd := exec.Command("bash", "-c", script)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
return err
}
Expand Down
9 changes: 7 additions & 2 deletions pkg/templates/go_web_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package templates

import (
"fmt"
"os"
"os/exec"

"github.com/pefish/create-app/pkg/global"
go_shell "github.com/pefish/go-shell"
)

type GoWebServerTemplate struct {
Expand Down Expand Up @@ -37,7 +39,10 @@ rm -rf ./init.sh
params.ProjectName,
params.ProjectName,
)
err := go_shell.NewCmd(script).Run()
cmd := exec.Command("bash", "-c", script)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
return err
}
Expand Down
9 changes: 7 additions & 2 deletions pkg/templates/react_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package templates

import (
"fmt"
"os"
"os/exec"

"github.com/pefish/create-app/pkg/global"
go_shell "github.com/pefish/go-shell"
)

type ReactAppTemplate struct {
Expand Down Expand Up @@ -35,7 +37,10 @@ npm install
params.ProjectName,
params.ProjectName,
)
err := go_shell.NewCmd(script).Run()
cmd := exec.Command("bash", "-c", script)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
return err
}
Expand Down
9 changes: 7 additions & 2 deletions pkg/templates/react_dapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package templates

import (
"fmt"
"os"
"os/exec"

"github.com/pefish/create-app/pkg/global"
go_shell "github.com/pefish/go-shell"
)

type ReactDappTemplate struct {
Expand Down Expand Up @@ -35,7 +37,10 @@ npm install
params.ProjectName,
params.ProjectName,
)
err := go_shell.NewCmd(script).Run()
cmd := exec.Command("bash", "-c", script)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
return err
}
Expand Down
9 changes: 7 additions & 2 deletions pkg/templates/rust_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package templates

import (
"fmt"
"os"
"os/exec"

"github.com/pefish/create-app/pkg/global"
go_shell "github.com/pefish/go-shell"
)

type RustAppTemplate struct {
Expand Down Expand Up @@ -37,7 +39,10 @@ rm -rf ./init.sh
params.ProjectName,
params.ProjectName,
)
err := go_shell.NewCmd(script).Run()
cmd := exec.Command("bash", "-c", script)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
return err
}
Expand Down
9 changes: 7 additions & 2 deletions pkg/templates/rust_lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package templates

import (
"fmt"
"os"
"os/exec"

"github.com/pefish/create-app/pkg/global"
go_shell "github.com/pefish/go-shell"
)

type RustLibTemplate struct {
Expand Down Expand Up @@ -35,7 +37,10 @@ cargo update
params.ProjectName,
params.ProjectName,
)
err := go_shell.NewCmd(script).Run()
cmd := exec.Command("bash", "-c", script)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
return err
}
Expand Down
9 changes: 7 additions & 2 deletions pkg/templates/solidity_dapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package templates

import (
"fmt"
"os"
"os/exec"

"github.com/pefish/create-app/pkg/global"
go_shell "github.com/pefish/go-shell"
)

type SolidityDappTemplate struct {
Expand Down Expand Up @@ -33,7 +35,10 @@ npm install
params.ProjectName,
params.ProjectName,
)
err := go_shell.NewCmd(script).Run()
cmd := exec.Command("bash", "-c", script)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
return err
}
Expand Down
9 changes: 7 additions & 2 deletions pkg/templates/ts_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package templates

import (
"fmt"
"os"
"os/exec"

"github.com/pefish/create-app/pkg/global"
go_shell "github.com/pefish/go-shell"
)

type TsAppTemplate struct {
Expand Down Expand Up @@ -36,7 +38,10 @@ cp config/sample.yaml config/local.yaml
params.ProjectName,
params.ProjectName,
)
err := go_shell.NewCmd(script).Run()
cmd := exec.Command("bash", "-c", script)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
return err
}
Expand Down
9 changes: 7 additions & 2 deletions pkg/templates/ts_lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package templates

import (
"fmt"
"os"
"os/exec"

"github.com/pefish/create-app/pkg/global"
go_shell "github.com/pefish/go-shell"
)

type TsLibTemplate struct {
Expand Down Expand Up @@ -35,7 +37,10 @@ npm install
params.ProjectName,
params.ProjectName,
)
err := go_shell.NewCmd(script).Run()
cmd := exec.Command("bash", "-c", script)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil {
return err
}
Expand Down

0 comments on commit b4bd01d

Please sign in to comment.