Update config generator
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
@ -47,9 +48,12 @@ func runConfigGenerateCmd(cmd *cobra.Command, args []string) {
|
||||
plog.Args("file", configFile))
|
||||
|
||||
} else {
|
||||
c, _ := yaml.Marshal(newConf)
|
||||
var c bytes.Buffer
|
||||
enc := yaml.NewEncoder(&c)
|
||||
enc.SetIndent(2)
|
||||
enc.Encode(newConf)
|
||||
plog.Info("Suggest running with --write or redirect (> " + configFile + ")")
|
||||
fmt.Print(string(c))
|
||||
fmt.Print(c.String())
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,6 +100,14 @@ func promptConfigSettings(c *config.Config) *config.Config {
|
||||
Show(); err == nil {
|
||||
c.GitlabToken = token
|
||||
}
|
||||
|
||||
if dirMode, err := pterm.DefaultInteractiveConfirm.
|
||||
WithDefaultValue(true).
|
||||
WithDefaultText("Open project directories instead of main files (yes for vscode)?").
|
||||
Show(); err == nil {
|
||||
c.Editor.OpenDirectory = dirMode
|
||||
}
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ func getEntrypointFile(projectPath string) string {
|
||||
if err := os.Chdir(projectPath); err != nil {
|
||||
return ""
|
||||
} else if conf.Editor.OpenDirectory {
|
||||
return projectPath
|
||||
return "."
|
||||
}
|
||||
|
||||
// Search list of well-known main files
|
||||
|
Reference in New Issue
Block a user