Skip to content

Commit

Permalink
Merge pull request #46 from c3pm-labs/cmd-init-fix
Browse files Browse the repository at this point in the history
fix: crash when using default argument in cmd/init
  • Loading branch information
Maxime Corbin authored Apr 17, 2021
2 parents 7d787fd + 4e00900 commit 692e34c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ var initCmd = &cobra.Command{
Args: func(cmd *cobra.Command, args []string) error {
if len(args) > 1 {
return fmt.Errorf("requires one or no arguments")
} else if len(args) == 0 {
cmd.SetArgs([]string{"."})
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
path := args[0]
var path string
if len(args) == 1 {
path = args[0]
} else {
path = "."
}
manifest, err := input.Init()
if err != nil {
return fmt.Errorf("failed to init project config: %w", err)
Expand Down

0 comments on commit 692e34c

Please sign in to comment.