You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
388 B
Go

package main
import (
"fmt"
"os/exec"
"time"
)
type gist struct {
ID string `json:"id"`
Created time.Time `json:"created_at"`
}
func (g gist) clone() error {
path := fmt.Sprintf("git@gist.github.com:%s.git", g.ID)
cmd := exec.Command("git", "clone", path)
if err := cmd.Run(); err != nil {
return fmt.Errorf("failed to clone gist %s: %w", g.ID, err)
}
return nil
}