gosick #1

Merged
DelphicOkami merged 162 commits from gosick into main 2026-03-21 23:08:00 +00:00
2 changed files with 20 additions and 11 deletions
Showing only changes of commit 4fb028cd81 - Show all commits

View File

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