subcommands

command
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2025 License: MIT Imports: 1 Imported by: 0

README

subcommands - creating subcommands

Image with flags

To create a sub-command for your main command, use the Subcommands field inside []*replyme.Command:

Subcommands: []&replyme.Command{
    {
        Name: "mySubCommand",
        Usage: "testMySubCommand",
        Action: func (ctx *replyme.Context) error {
            // your code
is return nil
        }
    }
}

This way you can add additional subcommands to your REPL.

Flag management

Flags can be used for both basic commands and additional commands.

For example: if the main create command had flags described, and then you added the data sub-command, then such a command will work fully.:

create --myCreateFlag="test" data --myDataFlag="test"

To get acquainted with the work example, look at the subcommands/main.go file.

The flow of action

In order to work with commands and sub-commands, there is a specific execution flow, which can be viewed inside the example Flow

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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