Skip to content
Open
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
25 changes: 23 additions & 2 deletions internal/setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func Create() error {

println()

// confirm
// confirm create new project
var ok bool
err := survey.AskOne(&survey.Confirm{
Message: fmt.Sprintf("No up.json found, create a new project?"),
Expand Down Expand Up @@ -106,7 +106,28 @@ func Create() error {
}

b, _ := json.MarshalIndent(c, "", " ")
return ioutil.WriteFile("up.json", b, 0644)
err = ioutil.WriteFile("up.json", b, 0644)
if err != nil {
return err
}

// confirm create .upignore
err = survey.AskOne(&survey.Confirm{
Message: fmt.Sprintf("Would you like to add an .upignore?"),
Default: true,
}, &ok, nil)

if err != nil {
return nil
}

if !ok {
return errors.New("aborted")
}

defaultIgnore := ".*\n"
b = []byte(defaultIgnore)
return ioutil.WriteFile(".upignore", b, 0644)
}

// defaultName returns the default app name.
Expand Down