feat(commit): implement commit command parity
This commit is contained in:
@@ -147,6 +147,24 @@ func (a *App) Push(castle string) error {
|
||||
return runGitWithIO(filepath.Join(a.ReposDir, castle), a.Stdout, a.Stderr, "push")
|
||||
}
|
||||
|
||||
func (a *App) Commit(castle string, message string) error {
|
||||
if strings.TrimSpace(castle) == "" {
|
||||
castle = "dotfiles"
|
||||
}
|
||||
|
||||
trimmedMessage := strings.TrimSpace(message)
|
||||
if trimmedMessage == "" {
|
||||
return errors.New("commit requires message")
|
||||
}
|
||||
|
||||
castledir := filepath.Join(a.ReposDir, castle)
|
||||
if err := runGitWithIO(castledir, a.Stdout, a.Stderr, "add", "--all"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return runGitWithIO(castledir, a.Stdout, a.Stderr, "commit", "-m", trimmedMessage)
|
||||
}
|
||||
|
||||
func (a *App) Link(castle string) error {
|
||||
if strings.TrimSpace(castle) == "" {
|
||||
castle = "dotfiles"
|
||||
|
||||
Reference in New Issue
Block a user