Skip to content

Commit 09eb44f

Browse files
authored
feat: ask before overwriting a xgenny file (#4728)
* feat: ask before overwriting a xgenny file * pass session to some levels * add skipUI into the cliui session * fix ask confirm skip * skip duplicated files * add globel function to applyprerun * fix wrong chain path for scaffold * fix duplicated files output * add changelog * fix lint
1 parent 7045273 commit 09eb44f

38 files changed

Lines changed: 459 additions & 112 deletions

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111

1212
- [#4691](https://github.com/ignite/cli/pull/4691), [#4706](https://github.com/ignite/cli/pull/4706), [#4725](https://github.com/ignite/cli/pull/4725) Fix ts-client query template and solely Go template for `ts-client` generation.
1313

14+
### Features
15+
16+
- [#4728](https://github.com/ignite/cli/pull/4728) Ask before overwriting a `xgenny` file.
17+
1418
## [`v29.0.0`](https://github.com/ignite/cli/releases/tag/v29.0.0)
1519

1620
### Features

ignite/cmd/chain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ chain.
104104
}
105105

106106
func preRunHandler(cmd *cobra.Command, _ []string) error {
107-
session := cliui.New()
107+
session := cliui.New(cliui.WithoutUserInteraction(getYes(cmd)))
108108
defer session.End()
109109

110110
appPath, err := goModulePath(cmd)

ignite/cmd/chain_debug.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ The debug server stops automatically when the client connection is closed.
6666
func chainDebugHandler(cmd *cobra.Command, _ []string) error {
6767
// Prepare session options.
6868
// Events are ignored by the session when the debug server UI is used.
69-
options := []cliui.Option{cliui.StartSpinnerWithText("Initializing...")}
69+
options := []cliui.Option{
70+
cliui.StartSpinnerWithText("Initializing..."),
71+
cliui.WithoutUserInteraction(getYes(cmd)),
72+
}
7073
server, _ := cmd.Flags().GetBool(flagServer)
7174
if server {
7275
options = append(options, cliui.IgnoreEvents())

ignite/cmd/chain_init.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ func chainInitHandler(cmd *cobra.Command, _ []string) error {
9898
session := cliui.New(
9999
cliui.WithVerbosity(getVerbosity(cmd)),
100100
cliui.StartSpinner(),
101+
cliui.WithoutUserInteraction(getYes(cmd)),
101102
)
102103
defer session.End()
103104

ignite/cmd/chain_lint.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ func NewChainLint() *cobra.Command {
1515
Long: "The lint command runs the golangci-lint tool to lint the codebase.",
1616
Args: cobra.NoArgs,
1717
RunE: func(cmd *cobra.Command, _ []string) error {
18-
session := cliui.New(cliui.StartSpinnerWithText("Linting..."))
18+
session := cliui.New(
19+
cliui.StartSpinnerWithText("Linting..."),
20+
cliui.WithoutUserInteraction(getYes(cmd)),
21+
)
1922
defer session.End()
2023

2124
chainOption := []chain.Option{

ignite/cmd/chain_serve.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ production, you may want to run "appd start" manually.
8383
}
8484

8585
func chainServeHandler(cmd *cobra.Command, _ []string) error {
86-
var options []cliui.Option
86+
options := []cliui.Option{cliui.WithoutUserInteraction(getYes(cmd))}
8787

8888
// Session must not handle events when the verbosity is the default
8989
// to allow render of the UI and events using bubbletea. The custom

ignite/cmd/doctor.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ func NewDoctor() *cobra.Command {
1414
Short: "Fix chain configuration",
1515
Hidden: true,
1616
RunE: func(cmd *cobra.Command, _ []string) error {
17-
session := cliui.New()
17+
session := cliui.New(
18+
cliui.WithoutUserInteraction(getYes(cmd)),
19+
)
1820
defer session.End()
1921
appPath := flagGetPath(cmd)
2022

ignite/cmd/generate_composables.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ func NewGenerateComposables() *cobra.Command {
2222
}
2323

2424
func generateComposablesHandler(cmd *cobra.Command, _ []string) error {
25-
session := cliui.New(cliui.StartSpinnerWithText(statusGenerating))
25+
session := cliui.New(
26+
cliui.StartSpinnerWithText(statusGenerating),
27+
cliui.WithoutUserInteraction(getYes(cmd)),
28+
)
2629
defer session.End()
2730

2831
c, err := chain.NewWithHomeFlags(

ignite/cmd/generate_go.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ func NewGenerateGo() *cobra.Command {
2121
}
2222

2323
func generateGoHandler(cmd *cobra.Command, _ []string) error {
24-
session := cliui.New(cliui.StartSpinnerWithText(statusGenerating))
24+
session := cliui.New(
25+
cliui.StartSpinnerWithText(statusGenerating),
26+
cliui.WithoutUserInteraction(getYes(cmd)),
27+
)
2528
defer session.End()
2629

2730
c, err := chain.NewWithHomeFlags(

ignite/cmd/generate_hooks.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ func NewGenerateHooks() *cobra.Command {
2222
}
2323

2424
func generateHooksHandler(cmd *cobra.Command, _ []string) error {
25-
session := cliui.New(cliui.StartSpinnerWithText(statusGenerating))
25+
session := cliui.New(
26+
cliui.StartSpinnerWithText(statusGenerating),
27+
cliui.WithoutUserInteraction(getYes(cmd)),
28+
)
2629
defer session.End()
2730

2831
c, err := chain.NewWithHomeFlags(

0 commit comments

Comments
 (0)