fml/magefile.go
Lilian Jónsdóttir ba36cba7bf initial code commit - basic functionality works
- automatically adds mods found in mods folder that aren't in mod-list.json
- read/write modlist from mod-list.json
- enable/disable mods
2024-02-09 10:53:06 -08:00

39 lines
691 B
Go

//go:build mage
package main
import (
"fmt"
"os"
"github.com/magefile/mage/sh"
)
var (
binaryName string = "fml"
buildDir string = "bin"
cmd string = fmt.Sprintf(".%[1]ccmd%[1]c%[2]s", os.PathSeparator, binaryName)
output string = fmt.Sprintf(".%[1]c%[2]s%[1]c%[3]s", os.PathSeparator, buildDir, binaryName)
)
func Build() error {
fmt.Println("Building...")
return sh.Run("go", "build", "-o", output, cmd)
}
func Run() error {
fmt.Println("Running...")
return sh.RunV("go", "run", cmd)
}
func RunBinary() error {
Build()
fmt.Println("Running binary...")
return sh.RunV(output)
}
func Clean() error {
fmt.Println("Cleaning...")
return os.Remove(output)
}