Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Command ¶
type Command interface { Execute() error Validate() error BuildSurvey() ([]*survey.Question, error) BuildCobraCommand() *cobra.Command }
Command minimal command definition.
type ProjectPathCommand ¶
type ProjectPathCommand struct { GoyaveMod *modfile.Require GoyaveVersion *semver.Version ProjectPath string }
ProjectPathCommand shared composition struct for commands using a Goyave project path. All commands compositing with this one should call "setup()" first in their "Execute()" function. Commands using ProjectPathCommand should have a project path flag and survey entry.
func (*ProjectPathCommand) Setup ¶
func (c *ProjectPathCommand) Setup() (int, error)
Setup ensure the `ProjectPath` field is correctly set. If `ProjectPath` is empty at the time `setup()` is called, its value will be set to `fs.FindParentModule()`. The project's `go.mod` file is parsed and put into the `GoyaveMod` field. The Goyave framework version is parsed and put into the `GoyaveVersion` field.
type SetupCommand ¶
type SetupCommand interface { // Setup returns the number of flags consumed by the setup operation. Setup() (int, error) }
SetupCommand for commands needing to execute some logic before being executed. If a command implements "Setup()", this function will be called first, before surveys and validation.