feat(pull): implement pull command parity

This commit is contained in:
Micheal Wilkinson
2026-03-20 17:44:13 +00:00
parent 4a422bd241
commit 4fb028cd81
2 changed files with 20 additions and 11 deletions

View File

@@ -155,7 +155,9 @@ func (c *versionCmd) Run(app *core.App) error {
return app.Version(version.String) return app.Version(version.String)
} }
type pullCmd struct{} type pullCmd struct {
Castle string `arg:"" optional:"" name:"CASTLE" help:"Castle name."`
}
type pushCmd struct{} type pushCmd struct{}
@@ -177,16 +179,16 @@ type rcCmd struct {
type generateCmd struct{} type generateCmd struct{}
func (c *pullCmd) Run() error { return notImplemented("pull") } func (c *pullCmd) Run(app *core.App) error { return app.Pull(defaultCastle(c.Castle)) }
func (c *pushCmd) Run() error { return notImplemented("push") } func (c *pushCmd) Run() error { return notImplemented("push") }
func (c *commitCmd) Run() error { return notImplemented("commit") } func (c *commitCmd) Run() error { return notImplemented("commit") }
func (c *destroyCmd) Run() error { return notImplemented("destroy") } func (c *destroyCmd) Run() error { return notImplemented("destroy") }
func (c *cdCmd) Run() error { return notImplemented("cd") } func (c *cdCmd) Run() error { return notImplemented("cd") }
func (c *openCmd) Run() error { return notImplemented("open") } func (c *openCmd) Run() error { return notImplemented("open") }
func (c *execCmd) Run() error { return notImplemented("exec") } func (c *execCmd) Run() error { return notImplemented("exec") }
func (c *execAllCmd) Run() error { return notImplemented("exec_all") } func (c *execAllCmd) Run() error { return notImplemented("exec_all") }
func (c *rcCmd) Run(app *core.App) error { return app.Rc(defaultCastle(c.Castle)) } func (c *rcCmd) Run(app *core.App) error { return app.Rc(defaultCastle(c.Castle)) }
func (c *generateCmd) Run() error { return notImplemented("generate") } func (c *generateCmd) Run() error { return notImplemented("generate") }
func defaultCastle(castle string) string { func defaultCastle(castle string) string {
if strings.TrimSpace(castle) == "" { if strings.TrimSpace(castle) == "" {

View File

@@ -133,6 +133,13 @@ func (a *App) Diff(castle string) error {
return runGitWithIO(filepath.Join(a.ReposDir, castle), a.Stdout, a.Stderr, "diff") return runGitWithIO(filepath.Join(a.ReposDir, castle), a.Stdout, a.Stderr, "diff")
} }
func (a *App) Pull(castle string) error {
if strings.TrimSpace(castle) == "" {
castle = "dotfiles"
}
return runGitWithIO(filepath.Join(a.ReposDir, castle), a.Stdout, a.Stderr, "pull")
}
func (a *App) Link(castle string) error { func (a *App) Link(castle string) error {
if strings.TrimSpace(castle) == "" { if strings.TrimSpace(castle) == "" {
castle = "dotfiles" castle = "dotfiles"