1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-17 18:07:01 +00:00
Files
kararas_iris/iris/run.go
Gerasimos (Makis) Maropoulos 8bbd9f8fc5 Happy new year! Update to 6.0.0 | HTTP/2 full support. https://github.com/kataras/iris/issues/565
full commit from development branch.

Examples, book, middleware, plugins are updated to the latest iris
version. Read HISTORY.md for more.

The 'old' v5 branch which relied on fasthttp exists for those who want
to use it navigate there: https://github.com/kataras/iris/tree/5.0.0
2017-01-02 21:20:17 +02:00

44 lines
1.1 KiB
Go

package main
import (
"os"
"strings"
"github.com/kataras/cli"
"github.com/kataras/go-errors"
"github.com/kataras/rizla/rizla"
)
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 {
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"
project.AllowReloadAfter = time.Duration(3) * time.Second
project.Out = rizla.NewPrinter(os.Stdout)
project.Err = rizla.NewPrinter(os.Stderr)
rizla.Add(project)
rizla.Run()
*/
// or just do that:
rizla.DefaultDisableProgramRerunOutput = true // we don't want the banner to be shown after the first run
rizla.Run(programPath)
}