feat(rc): add --force guard for legacy homesickrc
This commit is contained in:
@@ -191,6 +191,7 @@ type execAllCmd struct {
|
||||
}
|
||||
|
||||
type rcCmd struct {
|
||||
Force bool `help:"Bypass legacy .homesickrc safety confirmation."`
|
||||
Castle string `arg:"" optional:"" name:"CASTLE" help:"Castle name."`
|
||||
}
|
||||
|
||||
@@ -211,12 +212,18 @@ func (c *pushCmd) Run(app *core.App) error { return app.Push(defaultCastle(c.Cas
|
||||
func (c *commitCmd) Run(app *core.App) error {
|
||||
return app.Commit(defaultCastle(c.Castle), c.Message)
|
||||
}
|
||||
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(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 *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(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 {
|
||||
originalForce := app.Force
|
||||
app.Force = c.Force
|
||||
err := app.Rc(defaultCastle(c.Castle))
|
||||
app.Force = originalForce
|
||||
return err
|
||||
}
|
||||
func (c *generateCmd) Run(app *core.App) error { return app.Generate(c.Path) }
|
||||
|
||||
func defaultCastle(castle string) string {
|
||||
|
||||
Reference in New Issue
Block a user