Skip to content

Commit

Permalink
Merge branch 'main' into julien/fix-docs-build
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt authored Mar 9, 2025
2 parents cb78f3d + 680d0af commit feb05c3
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 22 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
- [#4463](https://github.com/ignite/cli/pull/4463) Run `chain simulation` with any simulation test case
- [#4533](https://github.com/ignite/cli/pull/4533) Promote GitHub codespace instead of Gitpod
- [#4549](https://github.com/ignite/cli/pull/4549) Remove unused placeholder vars
- [#4557](https://github.com/ignite/cli/pull/4557) Remove github.com/gookit/color

### Fixes

Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ require (
github.com/goccy/go-yaml v1.15.23
github.com/google/go-github/v48 v48.2.0
github.com/google/go-querystring v1.1.0
github.com/gookit/color v1.5.4
github.com/hashicorp/go-hclog v1.6.3
github.com/hashicorp/go-plugin v1.6.3
github.com/iancoleman/strcase v0.3.0
Expand Down Expand Up @@ -446,7 +445,6 @@ require (
github.com/vektra/mockery/v2 v2.46.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xen0n/gosmopolitan v1.2.2 // indirect
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
github.com/yagipy/maintidx v1.0.0 // indirect
github.com/yeya24/promlinter v0.3.0 // indirect
github.com/ykadowak/zerologlint v0.1.5 // indirect
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -968,8 +968,6 @@ github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqE
github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY=
github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4=
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0=
github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gordonklaus/ineffassign v0.1.0 h1:y2Gd/9I7MdY1oEIt+n+rowjBNDcLQq3RsH5hwJd0f9s=
github.com/gordonklaus/ineffassign v0.1.0/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0=
Expand Down Expand Up @@ -1742,8 +1740,6 @@ github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI
github.com/xen0n/gosmopolitan v1.2.2 h1:/p2KTnMzwRexIW8GlKawsTWOxn7UHA+jCMF/V8HHtvU=
github.com/xen0n/gosmopolitan v1.2.2/go.mod h1:7XX7Mj61uLYrj0qmeN0zi7XDon9JRAEhYQqAPLVNTeg=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8=
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM=
github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk=
Expand Down
10 changes: 7 additions & 3 deletions ignite/cmd/account_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ignitecmd
import (
"github.com/spf13/cobra"

"github.com/ignite/cli/v29/ignite/pkg/cliui"
"github.com/ignite/cli/v29/ignite/pkg/cosmosaccount"
"github.com/ignite/cli/v29/ignite/pkg/errors"
)
Expand All @@ -19,7 +20,11 @@ func NewAccountCreate() *cobra.Command {
}

func accountCreateHandler(cmd *cobra.Command, args []string) error {
name := args[0]
var (
name = args[0]
session = cliui.New(cliui.StartSpinnerWithText(statusCreating))
)
defer session.End()

ca, err := cosmosaccount.New(
cosmosaccount.WithKeyringBackend(getKeyringBackend(cmd)),
Expand All @@ -34,6 +39,5 @@ func accountCreateHandler(cmd *cobra.Command, args []string) error {
return errors.Errorf("unable to create account: %w", err)
}

cmd.Printf("Account %q created, keep your mnemonic in a secret place:\n\n%s\n", name, mnemonic)
return nil
return session.Printf("Account %q created, keep your mnemonic in a secret place:\n\n%s\n", name, mnemonic)
}
10 changes: 7 additions & 3 deletions ignite/cmd/account_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ignitecmd
import (
"github.com/spf13/cobra"

"github.com/ignite/cli/v29/ignite/pkg/cliui"
"github.com/ignite/cli/v29/ignite/pkg/cosmosaccount"
)

Expand All @@ -18,7 +19,11 @@ func NewAccountDelete() *cobra.Command {
}

func accountDeleteHandler(cmd *cobra.Command, args []string) error {
name := args[0]
var (
name = args[0]
session = cliui.New(cliui.StartSpinnerWithText(statusDeleting))
)
defer session.End()

ca, err := cosmosaccount.New(
cosmosaccount.WithKeyringBackend(getKeyringBackend(cmd)),
Expand All @@ -32,6 +37,5 @@ func accountDeleteHandler(cmd *cobra.Command, args []string) error {
return err
}

cmd.Printf("Account %s deleted.\n", name)
return nil
return session.Printf("Account %s deleted.\n", name)
}
10 changes: 6 additions & 4 deletions ignite/cmd/account_export.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/spf13/cobra"

"github.com/ignite/cli/v29/ignite/pkg/cliui"
"github.com/ignite/cli/v29/ignite/pkg/cosmosaccount"
"github.com/ignite/cli/v29/ignite/pkg/errors"
)
Expand All @@ -27,9 +28,11 @@ func NewAccountExport() *cobra.Command {

func accountExportHandler(cmd *cobra.Command, args []string) error {
var (
name = args[0]
path = flagGetPath(cmd)
name = args[0]
path = flagGetPath(cmd)
session = cliui.New(cliui.StartSpinnerWithText(statusExporting))
)
defer session.End()

passphrase, err := getPassphrase(cmd)
if err != nil {
Expand Down Expand Up @@ -65,6 +68,5 @@ func accountExportHandler(cmd *cobra.Command, args []string) error {
return err
}

cmd.Printf("Account %q exported to file: %s\n", name, path)
return nil
return session.Printf("Account %q exported to file: %s\n", name, path)
}
6 changes: 4 additions & 2 deletions ignite/cmd/account_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/cosmos/go-bip39"
"github.com/spf13/cobra"

"github.com/ignite/cli/v29/ignite/pkg/cliui"
"github.com/ignite/cli/v29/ignite/pkg/cliui/cliquiz"
"github.com/ignite/cli/v29/ignite/pkg/cosmosaccount"
"github.com/ignite/cli/v29/ignite/pkg/errors"
Expand All @@ -31,7 +32,9 @@ func accountImportHandler(cmd *cobra.Command, args []string) error {
var (
name = args[0]
secret, _ = cmd.Flags().GetString(flagSecret)
session = cliui.New(cliui.StartSpinnerWithText(statusImporting))
)
defer session.End()

if secret == "" {
if err := cliquiz.Ask(
Expand Down Expand Up @@ -70,6 +73,5 @@ func accountImportHandler(cmd *cobra.Command, args []string) error {
return err
}

cmd.Printf("Account %q imported.\n", name)
return nil
return session.Printf("Account %q imported.\n", name)
}
5 changes: 4 additions & 1 deletion ignite/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ const (
cacheFileName = "ignite_cache.db"

statusGenerating = "Generating..."
statusQuerying = "Querying..."
statusImporting = "Importing..."
statusExporting = "Exporting..."
statusCreating = "Creating..."
statusDeleting = "Deleting..."
)

// List of CLI level one commands that should not load Ignite app instances.
Expand Down
7 changes: 4 additions & 3 deletions ignite/pkg/cliui/clispinner/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import (
"time"

"github.com/briandowns/spinner"
"github.com/gookit/color"

"github.com/ignite/cli/v29/ignite/pkg/cliui/colors"
)

var (
simpleCharset = spinner.CharSets[4]
simpleRefreshRate = time.Millisecond * 300
simpleColor = color.Blue
simpleColor = colors.Spinner
)

type SimpleSpinner struct {
Expand Down Expand Up @@ -115,7 +116,7 @@ func (s *SimpleSpinner) Start() Spinner {
case <-ticker.C: // Update the spinner on each tick
s.mu.Lock()
frame := charset[index]
str := fmt.Sprintf("\r%s%s %s", prefix, simpleColor.Sprint(frame), text)
str := fmt.Sprintf("\r%s%s %s", prefix, simpleColor(frame), text)
_, _ = fmt.Fprint(writer, str) // Update the spinner in the same line
index++
if index >= len(charset) {
Expand Down
6 changes: 6 additions & 0 deletions ignite/pkg/cliui/colors/colors.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const (
Cyan = "#34e2e2"
White = "#FFFFFF"
HiBlue = "#729FCF"
Blue = "#0a2fc4"
)

var (
Expand All @@ -24,6 +25,7 @@ var (
modified = lipgloss.NewStyle().Foreground(lipgloss.Color(Magenta))
name = lipgloss.NewStyle().Bold(true)
mnemonic = lipgloss.NewStyle().Foreground(lipgloss.Color(HiBlue))
spinner = lipgloss.NewStyle().Foreground(lipgloss.Color(Blue))
faint = lipgloss.NewStyle().Faint(true)
)

Expand Down Expand Up @@ -65,6 +67,10 @@ func Mnemonic(i ...interface{}) string {
return mnemonic.Render(fmt.Sprint(i...))
}

func Spinner(i ...interface{}) string {
return spinner.Render(fmt.Sprint(i...))
}

// Faint styles the text using a dimmer shade for the foreground color.
func Faint(i ...interface{}) string {
return faint.Render(fmt.Sprint(i...))
Expand Down

0 comments on commit feb05c3

Please sign in to comment.