Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ cd into a flutter project.
cd projects/simpleApplication
```

The first time you use hover for a project, you'll need to initialize the project for desktop. `hover init` requires a project path. This is usualy the path for your project on github or a self-hosted git service. _If you are unsure, just make something up, it can always be changed later._
The first time you use hover for a project, you'll need to initialize the project for desktop. An argument can be passed to `hover init` to set the project path. This is usually the path for your project on github or a self-hosted git service. _If you are unsure, use `hover init`, the generated path can always be changed later._

```bash
hover init github.com/my-organization/simpleApplication
Expand Down
12 changes: 9 additions & 3 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@ var initCmd = &cobra.Command{
Use: "init [project]",
Short: "Initialize a flutter project to use go-flutter",
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return errors.New("requires one argument, the project path. e.g.: github.com/my-organization/my-app")
if len(args) > 1 {
return errors.New("allows only one argument, the project path. e.g.: github.com/my-organization/my-app")
}
return nil
},
Run: func(cmd *cobra.Command, args []string) {
projectPath := args[0]
assertInFlutterProject()

var projectPath string
if len(args) == 0 || args[0] == "." {
projectPath = getPubSpec().Name
} else {
projectPath = args[0]
}

err := os.Mkdir(buildPath, 0775)
if err != nil {
if os.IsExist(err) {
Expand Down