Skip to content

Commit

Permalink
remove line
Browse files Browse the repository at this point in the history
  • Loading branch information
samricotta committed Mar 13, 2023
1 parent b17be3b commit 31a6563
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions docs/docs/building-modules/09-autocli.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,25 +104,6 @@ https://github.com/cosmos/cosmos-sdk/blob/bcdf81cbaf8d70c4e4fa763f51292d54aed689

With this configuration, you can invoke the `GetTest` method by running `./app tx myservice get test`, and you can invoke the `GetTest2` method by running `./app tx myservice get test2`.

### Adding Custom Commands

Although `autocli` can automatically generate CLI commands and flags based on your protobuf messages, you may want to add custom commands to your CLI application. To add a custom command, you can use the `AddCommand()` method provided by `cobra`. For instance, to add a custom `test` command to your CLI application, you can use the following code:

``` go
rootCmd := autocli.RootCmd(appOptions)
rootCmd.AddCommand(&cobra.Command{
Use: "test",
Short: "custom test command",
RunE: func(cmd *cobra.Command, args []string) error {
// custom command logic here
return nil
},
})

```

This will add a new `test` command to your CLI application that can be invoked by running `./app test`.

## Customising Flag Names

By default, `autocli` generates flag names based on the names of the fields in your protobuf message. However, you can customise the flag names by providing a `FlagOptions` parameter to the `Builder.AddMessageFlags()` method. This parameter allows you to specify custom names for flags based on the names of the message fields. For example, if you have a message with the fields `test` and `test1`, you can use the following naming options to customise the flags
Expand Down

0 comments on commit 31a6563

Please sign in to comment.