mirror of
https://github.com/kataras/iris.git
synced 2025-12-20 03:17:04 +00:00
Fix and improve the iris cmd according to this: https://github.com/kataras/iris/issues/506
This commit is contained in:
20
iris/run.go
20
iris/run.go
@@ -6,16 +6,28 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/kataras/cli"
|
||||
"github.com/kataras/go-errors"
|
||||
"github.com/kataras/rizla/rizla"
|
||||
)
|
||||
|
||||
func runAndWatch(flags cli.Flags) error {
|
||||
func buildRunCommand() *cli.Cmd {
|
||||
return cli.Command("run", "runs and reload on source code changes, example: iris run main.go").Action(run)
|
||||
}
|
||||
|
||||
var errInvalidManualArgs = errors.New("Invalid arguments [%s], type -h to get assistant")
|
||||
|
||||
func run(cli.Flags) error {
|
||||
if len(os.Args) <= 2 {
|
||||
printer.Dangerf("Invalid arguments [%s], type -h to get assistant", strings.Join(os.Args, ","))
|
||||
os.Exit(-1)
|
||||
err := errInvalidManualArgs.Format(strings.Join(os.Args, ","))
|
||||
app.Printf(err.Error()) // the return should print it too but do it for any case
|
||||
return err
|
||||
}
|
||||
programPath := os.Args[2]
|
||||
runAndWatch(programPath)
|
||||
return nil
|
||||
}
|
||||
|
||||
func runAndWatch(programPath string) {
|
||||
/*
|
||||
project := rizla.NewProject(programPath)
|
||||
project.Name = "IRIS"
|
||||
@@ -29,6 +41,4 @@ func runAndWatch(flags cli.Flags) error {
|
||||
// or just do that:
|
||||
rizla.DefaultDisableProgramRerunOutput = true // we don't want the banner to be shown after the first run
|
||||
rizla.Run(programPath)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user