-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
38 lines (31 loc) · 876 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main
import (
"os"
"path"
"github.com/alexcoder04/LeoConsole-apkg-builder/pkg"
"github.com/alexcoder04/arrowprint"
"github.com/alexcoder04/friendly/v2"
)
func main() {
if len(os.Args) < 2 {
arrowprint.Err0("no arguments passed")
os.Exit(1)
}
folder := os.Args[1]
if folder[0] != '/' && folder[1] != ':' {
pwd, err := os.Getwd()
if err != nil {
arrowprint.Err0("cannot get working directory")
os.Exit(1)
}
folder = path.Join(pwd, folder)
}
buildFolder := path.Join(os.TempDir(), "apkg-build")
manifest := pkg.LoadManifest(folder)
pkg.Compile(folder, manifest)
pkg.PreparePackage(folder, buildFolder, manifest)
pkg.GenPkgInfo(buildFolder, manifest)
outputFile := path.Join(folder, manifest.PackageName+".lcp")
friendly.CompressFolder(buildFolder, outputFile)
arrowprint.Suc0("Done. Package archive saved to %s.", outputFile)
}