Skip to content

Commit 71e0793

Browse files
authored
Merge pull request #22 from go-flutter-desktop/simpler-hover-init
feat: don't require a arg when hover init
2 parents ed3afc7 + 3a1d7c6 commit 71e0793

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ cd into a flutter project.
4444
cd projects/simpleApplication
4545
```
4646

47-
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._
47+
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._
4848

4949
```bash
5050
hover init github.com/my-organization/simpleApplication

cmd/init.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,21 @@ var initCmd = &cobra.Command{
1919
Use: "init [project]",
2020
Short: "Initialize a flutter project to use go-flutter",
2121
Args: func(cmd *cobra.Command, args []string) error {
22-
if len(args) != 1 {
23-
return errors.New("requires one argument, the project path. e.g.: github.com/my-organization/my-app")
22+
if len(args) > 1 {
23+
return errors.New("allows only one argument, the project path. e.g.: github.com/my-organization/my-app")
2424
}
2525
return nil
2626
},
2727
Run: func(cmd *cobra.Command, args []string) {
28-
projectPath := args[0]
2928
assertInFlutterProject()
3029

30+
var projectPath string
31+
if len(args) == 0 || args[0] == "." {
32+
projectPath = getPubSpec().Name
33+
} else {
34+
projectPath = args[0]
35+
}
36+
3137
err := os.Mkdir(buildPath, 0775)
3238
if err != nil {
3339
if os.IsExist(err) {

0 commit comments

Comments
 (0)