Пример #1
0
func init() {

	// set the current working dir
	if d, err := os.Getwd(); err != nil {
		panic(err)
	} else {
		workingDir = d
	}

	// init the cli app
	app = cli.NewApp("iris", "Command line tool for Iris web framework", Version)
	// version command
	app.Command(cli.Command("version", "\t      prints your iris version").Action(func(cli.Flags) error { app.Printf("%s", iris.Version); return nil }))

	// create command/-/create.go
	createCmd := cli.Command("create", "create a project to a given directory").
		Flag("offline", false, "set to true to disable the packages download on each create command").
		Flag("dir", workingDir, "$GOPATH/src/$dir the directory to install the sample package").
		Flag("type", "basic", "creates a project based on the -t package. Currently, available types are 'basic' & 'static'").
		Action(create)

	// run command/-/run.go
	runAndWatchCmd := cli.Command("run", "runs and reload on source code changes, example: iris run main.go").Action(runAndWatch)

	// register the commands
	app.Command(createCmd)
	app.Command(runAndWatchCmd)

	// init the logger
	printer = logger.New(config.DefaultLogger())
}
Пример #2
0
func init() {
	app = cli.NewApp("iris", "Command line tool for Iris web framework", "0.0.4")
	app.Command(cli.Command("version", "\t      prints your iris version").Action(func(cli.Flags) error { app.Printf("%s", iris.Version); return nil }))

	createCmd := cli.Command("create", "create a project to a given directory").
		Flag("offline", false, "set to true to disable the packages download on each create command").
		Flag("dir", "myiris", "$GOPATH/src/$dir the directory to install the sample package").
		Flag("type", "basic", "creates a project based on the -t package. Currently, available types are 'basic' & 'static'").
		Action(create)

	app.Command(createCmd)
}
Пример #3
0
func buildGetCommand() *cli.Cmd {
	var availabletypes []string
	for k := range projects {
		availabletypes = append(availabletypes, "'"+k+"'")
	}
	// comma separated of projects' map key
	return cli.Command("get", "gets & runs a simple prototype-based project").
		Flag("type",
			"basic",
			// we take the os.Args in order to have access both via subcommand and when flag passed
			"downloads, installs and runs a project based on a prototype. Currently, available types are: "+strings.Join(availabletypes, ",")).
		Action(get)
}
Пример #4
0
func init() {
	// init the cli app
	app = cli.NewApp("iris", "Command line tool for Iris web framework", iris.Version)
	// version command
	app.Command(cli.Command("version", "\t      prints your iris version").
		Action(func(cli.Flags) error { app.Printf("%s", app.Version); return nil }))
	// run command/-/run.go

	// register the commands
	app.Command(buildGetCommand())
	app.Command(buildRunCommand())

}
Пример #5
0
func buildRunCommand() *cli.Cmd {
	return cli.Command("run", "runs and reload on source code changes, example: iris run main.go").Action(run)
}