-
Notifications
You must be signed in to change notification settings - Fork 547
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create generate proto-pulsar commands
- Loading branch information
Pantani
authored and
Pantani
committed
Jul 3, 2023
1 parent
658897e
commit 8f56bf3
Showing
6 changed files
with
91 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package ignitecmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/ignite/cli/ignite/pkg/cliui" | ||
"github.com/ignite/cli/ignite/pkg/cliui/icons" | ||
"github.com/ignite/cli/ignite/services/chain" | ||
) | ||
|
||
func NewGeneratePulsar() *cobra.Command { | ||
c := &cobra.Command{ | ||
Use: "proto-pulsar", | ||
Short: "Compile protocol buffer files to Go pulsar source code required by Cosmos SDK", | ||
RunE: generatePulsarHandler, | ||
} | ||
|
||
c.Flags().AddFlagSet(flagSetYes()) | ||
|
||
return c | ||
} | ||
|
||
func generatePulsarHandler(cmd *cobra.Command, _ []string) error { | ||
session := cliui.New(cliui.StartSpinnerWithText(statusGenerating)) | ||
defer session.End() | ||
|
||
c, err := newChainWithHomeFlags( | ||
cmd, | ||
chain.WithOutputer(session), | ||
chain.CollectEvents(session.EventBus()), | ||
chain.CheckCosmosSDKVersion(), | ||
) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
cacheStorage, err := newCache(cmd) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if err := c.Generate(cmd.Context(), cacheStorage, chain.GeneratePulsar()); err != nil { | ||
return err | ||
} | ||
|
||
return session.Println(icons.OK, "Generated Go pulsar code") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters