Skip to content
Merged
Show file tree
Hide file tree
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
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
Loading