forked from hanwen/go-fuse
/
main.go
41 lines (34 loc) · 859 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
39
40
41
package main
import (
"flag"
"fmt"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/zipfs"
"log"
"os"
)
var _ = log.Printf
func main() {
// Scans the arg list and sets up flags
debug := flag.Bool("debug", false, "print debugging messages.")
latencies := flag.Bool("latencies", false, "record operation latencies.")
flag.Parse()
if flag.NArg() < 2 {
fmt.Fprintf(os.Stderr, "usage: %s MOUNTPOINT ZIP-FILE\n", os.Args[0])
os.Exit(2)
}
var fs fuse.NodeFileSystem
fs, err := zipfs.NewArchiveFileSystem(flag.Arg(1))
if err != nil {
fmt.Fprintf(os.Stderr, "NewArchiveFileSystem failed: %v\n", err)
os.Exit(1)
}
state, _, err := fuse.MountNodeFileSystem(flag.Arg(0), fs, nil)
if err != nil {
fmt.Printf("Mount fail: %v\n", err)
os.Exit(1)
}
state.SetRecordStatistics(*latencies)
state.Debug = *debug
state.Loop()
}