Skip to content
Myr

cmd: Fix incorrect initialzation by `cobra init .`

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Close #314

authored by Albert Nigmatzianov · committed by Albert Nigmatzianov · parent 7bd35d3 · Browse files · 1 file+8 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−4 removed

  • other:+8 added−4 removed

1 file+8 added−4 removed

modified:cobra/cmd/init.go+8 added-4 removed
38 unmodified lines
3940Init will not use an existing directory with contents.`,4142 Run: func(cmd *cobra.Command, args []string) {43 wd, err := os.Getwd()44 if err != nil {45 er(err)46 }4748 var project *Project49 if len(args) == 0 {45 wd, err := os.Getwd()46 if err != nil {47 er(err)48 }50 project = NewProjectFromPath(wd)51 } else if len(args) == 1 {52 arg := args[0]53 if arg[0] == '.' {54 arg = filepath.Join(wd, arg)55 }56 if filepath.IsAbs(arg) {57 project = NewProjectFromPath(arg)58 } else {59 project = NewProject(arg)
175 unmodified lines