- Implements all placeholder Go examples in the `examples` directory. - Corrects the `run_matrix_programmatically` example to use the `borg` package. - Refactors the code to centralize the matrix execution logic in the `matrix` package. - Updates the documentation to include a new "Programmatic Usage" section that describes all of the Go examples. - Updates the "Terminal Isolation Matrix" section to remove manual 'runc' instructions, emphasizing that 'borg run' handles this process to maintain security and isolation. - Adds missing examples for 'collect github repos', 'collect github release', and 'compile' commands to the documentation.
37 lines
733 B
Go
37 lines
733 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/Snider/Borg/pkg/pwa"
|
|
)
|
|
|
|
func main() {
|
|
log.Println("Collecting PWA...")
|
|
|
|
client := pwa.NewPWAClient()
|
|
pwaURL := "https://squoosh.app"
|
|
|
|
manifestURL, err := client.FindManifest(pwaURL)
|
|
if err != nil {
|
|
log.Fatalf("Failed to find manifest: %v", err)
|
|
}
|
|
|
|
dn, err := client.DownloadAndPackagePWA(pwaURL, manifestURL, nil)
|
|
if err != nil {
|
|
log.Fatalf("Failed to download and package PWA: %v", err)
|
|
}
|
|
|
|
tarball, err := dn.ToTar()
|
|
if err != nil {
|
|
log.Fatalf("Failed to serialize datanode to tar: %v", err)
|
|
}
|
|
|
|
err = os.WriteFile("pwa.dat", tarball, 0644)
|
|
if err != nil {
|
|
log.Fatalf("Failed to write datanode file: %v", err)
|
|
}
|
|
|
|
log.Println("Successfully created pwa.dat")
|
|
}
|