allow ipns to be mounted by mount command
Jeromy committed
Sep 25, 2014 at 11:23 UTC
16aa636273355f0c9c71e82d9c265e4823cc8372
1 file changed
+16
cmd/ipfs/mount_unix.go
+16
@@ -11,6 +11,7 @@ import (
11
ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
12
13
"github.com/jbenet/go-ipfs/daemon"
14
+ ipns "github.com/jbenet/go-ipfs/fuse/ipns"
15
rofs "github.com/jbenet/go-ipfs/fuse/readonly"
16
u "github.com/jbenet/go-ipfs/util"
17
)
@@ -29,6 +30,10 @@ var cmdIpfsMount = &commander.Command{
30
Flag: *flag.NewFlagSet("ipfs-mount", flag.ExitOnError),
31
}
32
33
+func init() {
34
+ cmdIpfsMount.Flag.String("n", "", "specify a mountpoint for ipns")
35
+}
36
+
37
func mountCmd(c *commander.Command, inp []string) error {
38
if len(inp) < 1 || len(inp[0]) == 0 {
39
u.POut(c.Long)
@@ -66,5 +71,16 @@ func mountCmd(c *commander.Command, inp []string) error {
71
72
mp := inp[0]
73
fmt.Printf("Mounting at %s\n", mp)
74
+
75
+ ns, ok := c.Flag.Lookup("n").Value.Get().(string)
76
+ if ok {
77
+ go func() {
78
+ err = ipns.Mount(n, ns, mp)
79
+ if err != nil {
80
+ fmt.Printf("Error mounting ipns: %s\n", err)
81
+ }
82
+ }()
83
+ }
84
+
85
return rofs.Mount(n, mp)
86
}