This repository has been archived on 2023-11-08. You can view files and clone it, but cannot push or open issues/pull-requests.
eget/main.go

41 lines
544 B
Go
Raw Normal View History

package main
import (
"fmt"
"os"
"strings"
"go.jolheiser.com/eget/disk"
"go.jolheiser.com/eget/forge"
)
var Version = "develop"
func main() {
if len(os.Args) < 2 {
fmt.Println("eget <project URI>")
return
}
var f forge.Forger
var err error
uri := os.Args[1]
f, err = forge.NewGitea(uri)
if strings.HasPrefix(uri, "github") {
f, err = forge.NewGitHub(uri)
}
if err != nil {
panic(err)
}
asset, err := forge.Latest(f)
if err != nil {
panic(err)
}
if err := disk.Install(asset); err != nil {
panic(err)
}
}