feat(cli): implement exec and exec_all commands

This commit is contained in:
Micheal Wilkinson
2026-03-20 18:00:05 +00:00
parent 79d4577083
commit 58f70860ee
4 changed files with 168 additions and 4 deletions

View File

@@ -180,9 +180,14 @@ type openCmd struct {
Castle string `arg:"" optional:"" name:"CASTLE" help:"Castle name."`
}
type execCmd struct{}
type execCmd struct {
Castle string `arg:"" name:"CASTLE" help:"Castle name."`
Command []string `arg:"" name:"COMMAND" help:"Shell command to execute in the castle root."`
}
type execAllCmd struct{}
type execAllCmd struct {
Command []string `arg:"" name:"COMMAND" help:"Shell command to execute in each castle root."`
}
type rcCmd struct {
Castle string `arg:"" optional:"" name:"CASTLE" help:"Castle name."`
@@ -200,8 +205,8 @@ func (c *commitCmd) Run(app *core.App) error {
func (c *destroyCmd) Run(app *core.App) error { return app.Destroy(defaultCastle(c.Castle)) }
func (c *cdCmd) Run(app *core.App) error { return app.ShowPath(defaultCastle(c.Castle)) }
func (c *openCmd) Run(app *core.App) error { return app.Open(defaultCastle(c.Castle)) }
func (c *execCmd) Run() error { return notImplemented("exec") }
func (c *execAllCmd) Run() error { return notImplemented("exec_all") }
func (c *execCmd) Run(app *core.App) error { return app.Exec(c.Castle, c.Command) }
func (c *execAllCmd) Run(app *core.App) error { return app.ExecAll(c.Command) }
func (c *rcCmd) Run(app *core.App) error { return app.Rc(defaultCastle(c.Castle)) }
func (c *generateCmd) Run(app *core.App) error { return app.Generate(c.Path) }