command/

directory
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2023 License: AGPL-3.0

README

Command directory

This directory houses custom cobra commands which can be added as subcommands to the root dydxprotocold command defined in cmd/dydxprotocold/main.go.

Conventionally, each package in this directory should define a public Command() method which returns a *cobra.Command.

These commands can be added as a subcommand to the dydxprotocold root command defined in main.go in the following way:

rootCmd, _ := NewRootCmd(...)

rootCmd.AddCommand(mycommandpkg.Command())

The above will surface your command as dydxprotocold mycommand.

If instead you wish to define your command as the subcommand of a subcommand (i.e. You wish define something like dydxprotocold tendermint mycommmand), you can first search for the subcommand (i.e. tendermint) and subsequently add your command to it like so:

// Fetch Tendermint subcommand.
tmCmd, _, err := rootCmd.Find([]string{"tendermint"})
if err != nil {
  os.Exit(1)
}

// Add "mycommand" command to Tendermint subcommand.
tmCmd.AddCommand(mycommandpkg.Command())

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL