This repository has been archived on 2023-11-08. You can view files and clone it, but cannot push or open issues/pull-requests.
2023-01-12 05:11:26 +00:00
|
|
|
package main
|
|
|
|
|
2023-01-13 23:04:41 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"go.jolheiser.com/eget/disk"
|
|
|
|
"go.jolheiser.com/eget/forge"
|
|
|
|
)
|
|
|
|
|
2023-01-12 05:11:26 +00:00
|
|
|
var Version = "develop"
|
|
|
|
|
|
|
|
func main() {
|
2023-01-13 23:04:41 +00:00
|
|
|
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)
|
|
|
|
}
|
2023-01-12 05:11:26 +00:00
|
|
|
}
|