diff --git a/internal/homesick/cli/cli.go b/internal/homesick/cli/cli.go index b0d4bc7..701e508 100644 --- a/internal/homesick/cli/cli.go +++ b/internal/homesick/cli/cli.go @@ -159,7 +159,9 @@ type pullCmd struct { Castle string `arg:"" optional:"" name:"CASTLE" help:"Castle name."` } -type pushCmd struct{} +type pushCmd struct { + Castle string `arg:"" optional:"" name:"CASTLE" help:"Castle name."` +} type commitCmd struct{} @@ -180,7 +182,7 @@ type rcCmd struct { type generateCmd struct{} 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(app *core.App) error { return app.Push(defaultCastle(c.Castle)) } func (c *commitCmd) Run() error { return notImplemented("commit") } func (c *destroyCmd) Run() error { return notImplemented("destroy") } func (c *cdCmd) Run() error { return notImplemented("cd") } diff --git a/internal/homesick/core/core.go b/internal/homesick/core/core.go index 549428a..bd900f9 100644 --- a/internal/homesick/core/core.go +++ b/internal/homesick/core/core.go @@ -140,6 +140,13 @@ func (a *App) Pull(castle string) error { return runGitWithIO(filepath.Join(a.ReposDir, castle), a.Stdout, a.Stderr, "pull") } +func (a *App) Push(castle string) error { + if strings.TrimSpace(castle) == "" { + castle = "dotfiles" + } + return runGitWithIO(filepath.Join(a.ReposDir, castle), a.Stdout, a.Stderr, "push") +} + func (a *App) Link(castle string) error { if strings.TrimSpace(castle) == "" { castle = "dotfiles"