mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 10:41:03 +01:00
Iris cmd version 0.0.3
This commit is contained in:
parent
69409ea25c
commit
8fd5830e2c
|
@ -4,7 +4,7 @@ This package is the command line tool for [../](https://github.com/kataras/iris
|
||||||
|
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
Current version: 0.0.2
|
Current version: 0.0.3
|
||||||
```sh
|
```sh
|
||||||
|
|
||||||
go get -u github.com/kataras/iris/iris
|
go get -u github.com/kataras/iris/iris
|
||||||
|
|
15
iris/main.go
15
iris/main.go
|
@ -30,11 +30,11 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
app = cli.NewApp("iris", "Command line tool for Iris web framework", "0.0.2")
|
app = cli.NewApp("iris", "Command line tool for Iris web framework", "0.0.3")
|
||||||
app.Command(cli.Command("version", "\t prints your iris version").Action(func(cli.Flags) error { app.Printf("%s", iris.Version); return nil }))
|
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").
|
createCmd := cli.Command("create", "create a project to a given directory").
|
||||||
Flag("dev", true, "set to false to disable the packages download on each create command").
|
Flag("offline", false, "set to true to disable the packages download on each create command").
|
||||||
Flag("dir", "./", "creates an iris starter kit to the current directory").
|
Flag("dir", "./", "creates an iris starter kit to the current directory").
|
||||||
Flag("type", "basic", "creates the project based on the -t package. Currently, available types are 'basic' & 'static'").
|
Flag("type", "basic", "creates the project based on the -t package. Currently, available types are 'basic' & 'static'").
|
||||||
Action(create)
|
Action(create)
|
||||||
|
@ -48,7 +48,7 @@ func main() {
|
||||||
|
|
||||||
func create(flags cli.Flags) (err error) {
|
func create(flags cli.Flags) (err error) {
|
||||||
|
|
||||||
if !utils.DirectoryExists(packagesInstallDir) || flags.Bool("dev") {
|
if !utils.DirectoryExists(packagesInstallDir) || !flags.Bool("offline") {
|
||||||
downloadPackages()
|
downloadPackages()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,19 +67,24 @@ func create(flags cli.Flags) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func downloadPackages() {
|
func downloadPackages() {
|
||||||
|
errMsg := "\nProblem while downloading the assets from the internet for the first time. Trace: %s"
|
||||||
|
|
||||||
installedDir, err := utils.Install(PackagesURL, packagesInstallDir)
|
installedDir, err := utils.Install(PackagesURL, packagesInstallDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.Printf("\nProblem while downloading the assets from the internet for the first time. Trace: %s", err.Error())
|
app.Printf(errMsg, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// installedDir is the packagesInstallDir+PackagesExportedName, we will copy these contents to the parent, to the packagesInstallDir, because of import paths.
|
// installedDir is the packagesInstallDir+PackagesExportedName, we will copy these contents to the parent, to the packagesInstallDir, because of import paths.
|
||||||
|
|
||||||
err = utils.CopyDir(installedDir, packagesInstallDir)
|
err = utils.CopyDir(installedDir, packagesInstallDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.Printf("\nProblem while downloading the assets from the internet for the first time. Trace: %s", err.Error())
|
app.Printf(errMsg, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we don't exit on errors here.
|
||||||
|
|
||||||
// try to remove the unzipped folder
|
// try to remove the unzipped folder
|
||||||
utils.RemoveFile(installedDir)
|
utils.RemoveFile(installedDir)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user