Skip to content

Commit

Permalink
fix: init target project name (#1068)
Browse files Browse the repository at this point in the history
  • Loading branch information
liu-hm19 authored Jun 6, 2024
1 parent 00af90c commit 6c426ce
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/cmd/init/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package init
import (
"errors"
"fmt"
"path/filepath"

"kusionstack.io/kusion/pkg/cmd/init/util"
"kusionstack.io/kusion/pkg/scaffold"
Expand Down Expand Up @@ -40,6 +41,14 @@ func (o *Options) Complete(args []string) error {
o.Name = name
if o.ProjectDir == "" {
o.ProjectDir = dir
} else {
// Use the absolute path of the target project directory.
absTargetDir, err := filepath.Abs(o.ProjectDir)
if err != nil {
return err
}
o.ProjectDir = absTargetDir
o.Name = filepath.Base(o.ProjectDir)
}

return nil
Expand Down

0 comments on commit 6c426ce

Please sign in to comment.