mirror of
https://github.com/digarok/Appy.git
synced 2024-12-03 04:50:08 +00:00
52f839cd7d
* bump for more formatter fixes (DUPE, woops) * Add `indent` option and improve cadius errors
41 lines
921 B
Go
41 lines
921 B
Go
package core
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os/exec"
|
|
|
|
"github.com/digarok/appy/core/project"
|
|
"github.com/fatih/color"
|
|
)
|
|
|
|
func CreateDisk(name string, file string, size string) {
|
|
fmt.Printf("Creating Disk: \"%s\" -> %s \tSize: %s\n", name, file, size)
|
|
|
|
out, err := exec.Command(project.LocalConf.Programs.Cadius, "CREATEVOLUME", file, name, size).Output()
|
|
if err != nil {
|
|
color.Cyan(string(out))
|
|
log.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func AddFiles(disk project.Disk) {
|
|
fmt.Printf("Add files to: \"%s\"\n", disk.Name)
|
|
for _, file := range disk.Files {
|
|
fmt.Printf(" Adding file: -----> %s\n", file.Input)
|
|
|
|
out, err := exec.Command(project.LocalConf.Programs.Cadius, "ADDFILE", disk.File, file.Output, file.Input).Output()
|
|
if err != nil {
|
|
color.Cyan(string(out))
|
|
log.Fatal(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func BuildDisk() {
|
|
for _, disk := range project.AppyProj.Disks {
|
|
CreateDisk(disk.Name, disk.File, disk.Size)
|
|
AddFiles(disk)
|
|
}
|
|
}
|