Commit da1890e5 authored by Jeromy's avatar Jeromy Committed by Juan Batiz-Benet

add run command

parent b5fd9492
......@@ -51,6 +51,7 @@ Use "ipfs help <command>" for more information about a command.
cmdIpfsMount,
cmdIpfsInit,
cmdIpfsServe,
cmdIpfsRun,
},
Flag: *flag.NewFlagSet("ipfs", flag.ExitOnError),
}
......
package main
import (
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/commander"
"github.com/jbenet/go-ipfs/daemon"
u "github.com/jbenet/go-ipfs/util"
)
var cmdIpfsRun = &commander.Command{
UsageLine: "run",
Short: "run local ifps node.",
Long: `run a local ipfs node with no other interface.
`,
Run: runCmd,
Flag: *flag.NewFlagSet("ipfs-run", flag.ExitOnError),
}
func runCmd(c *commander.Command, inp []string) error {
u.Debug = true
n, err := localNode(true)
if err != nil {
return err
}
dl, err := daemon.NewDaemonListener(n, "localhost:12345")
if err != nil {
return err
}
dl.Listen()
dl.Close()
return nil
}
......@@ -98,7 +98,11 @@ func (s *Node) Attr() fuse.Attr {
case mdag.PBData_File, mdag.PBData_Raw:
u.DOut("this is a file.\n")
size, _ := s.Nd.Size()
return fuse.Attr{Mode: 0444, Size: uint64(size)}
return fuse.Attr{
Mode: 0444,
Size: uint64(size),
Blocks: uint64(len(s.Nd.Links)),
}
default:
u.PErr("Invalid data type.")
return fuse.Attr{}
......
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