climax icon indicating copy to clipboard operation
climax copied to clipboard

Lightweight command syntax

Open tucnak opened this issue 8 years ago • 1 comments

We need a super lightweight syntax of creating simple flag-less commands. Something like this would be great:

app := climax.New("appname")

app.Comm("command", "i am command", func (ctx climax.Context) {
    return 0;
});

tucnak avatar Nov 10 '16 20:11 tucnak

Try:

type Application struct {
	Version string // `1.5`
	Command

	Commands []*Command
	Topics   []*Topic
	Groups   []*Group

	// Default is a default handler. It gets executed if there are
	// no command line arguments (except the program name), when
	// otherwise, by default, the help entry is being shown.
	Default CmdHandler

	ungroupedCmdsCount int
}

ccpaging avatar Jan 24 '19 06:01 ccpaging