提交 234afc88 作者: Michael Pfister

Adds repo version info to repo stat command

addresses #2571

License: MIT
Signed-off-by: 's avatarMike Pfister <pfista@gmail.com>
上级 d6654e50
......@@ -109,6 +109,7 @@ set of stored objects and print repo statistics. It outputs to stdout:
NumObjects int Number of objects in the local repo.
RepoPath string The path to the repo being currently used.
RepoSize int Size in bytes that the repo is currently taking.
Version string The repo version
`,
},
Run: func(req cmds.Request, res cmds.Response) {
......@@ -151,6 +152,7 @@ RepoSize int Size in bytes that the repo is currently taking.
fmt.Fprintf(buf, "RepoSize \t %d\n", stat.RepoSize)
}
fmt.Fprintf(buf, "RepoPath \t %s\n", stat.RepoPath)
fmt.Fprintf(buf, "Version \t %s\n", stat.Version)
return buf, nil
},
......
......@@ -10,6 +10,7 @@ type Stat struct {
NumObjects uint64
RepoSize uint64 // size in bytes
RepoPath string
Version string
}
func RepoStat(n *core.IpfsNode, ctx context.Context) (*Stat, error) {
......@@ -39,5 +40,6 @@ func RepoStat(n *core.IpfsNode, ctx context.Context) (*Stat, error) {
NumObjects: count,
RepoSize: usage,
RepoPath: path,
Version: "fs-repo@" + fsrepo.RepoVersion,
}, nil
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论