Commit 564303ae authored by Amos Wenger's avatar Amos Wenger

Add option for lilboar to extract (in memory)

parent fc1ce251
Pipeline #10352 passed with stage
in 2 minutes and 10 seconds
package main
import (
"flag"
"log"
"os"
"path/filepath"
"github.com/itchio/boar"
"github.com/itchio/savior"
"github.com/itchio/wharf/eos"
"github.com/itchio/wharf/state"
"net/http"
_ "net/http/pprof"
)
var extract bool
func init() {
flag.BoolVar(&extract, "extract", false, "Perform in-memory extraction")
}
func main() {
go func() {
log.Println(http.ListenAndServe("localhost:9000", nil))
}()
log.SetFlags(0)
flag.Parse()
args := os.Args[1:]
args := flag.Args()
if len(args) < 1 {
log.Fatal("Usage: lilboar FILE [...FILE]")
}
......@@ -42,6 +57,20 @@ func main() {
}
consumer.Infof("%s: %s", filepath.Base(filePath), info)
if extract {
ex, err := info.GetExtractor(file, consumer)
if err != nil {
consumer.Errorf("%s: %v", filePath, err)
return
}
_, err = ex.Resume(nil, &savior.NopSink{})
if err != nil {
consumer.Errorf("%s: %v", filePath, err)
return
}
}
}
for _, arg := range args {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment