chore(go): inject stdin and pass rc force explicitly

This commit is contained in:
Micheal Wilkinson
2026-03-21 20:45:05 +00:00
parent 038b109e7b
commit d642870a66
7 changed files with 66 additions and 66 deletions

View File

@@ -13,10 +13,10 @@ import (
"github.com/alecthomas/kong"
)
func Run(args []string, stdout io.Writer, stderr io.Writer) int {
func Run(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) int {
model := &cliModel{}
app, err := core.New(stdout, stderr)
app, err := core.NewApp(stdin, stdout, stderr)
if err != nil {
_, _ = fmt.Fprintf(stderr, "error: %v\n", err)
return 1
@@ -227,11 +227,7 @@ func (c *openCmd) Run(app *core.App) error { return app.Open(defaultCastle(c.
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
return app.Rc(defaultCastle(c.Castle), c.Force)
}
func (c *generateCmd) Run(app *core.App) error { return app.Generate(c.Path) }
@@ -329,11 +325,3 @@ type cliExitError struct {
func (e *cliExitError) Error() string {
return e.err.Error()
}
func notImplemented(command string) error {
return &cliExitError{code: 2, err: fmt.Errorf("%s is not implemented in Go yet", command)}
}
func init() {
_ = os.Setenv("GIT_TERMINAL_PROMPT", "0")
}