Skip to content

Commit

Permalink
Adds repo version info to repo stat command
Browse files Browse the repository at this point in the history
addresses ipfs#2571

License: MIT
Signed-off-by: Mike Pfister <pfista@gmail.com>
  • Loading branch information
pfista committed Apr 21, 2016
1 parent cb41925 commit 7327afd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/commands/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,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) {
Expand Down Expand Up @@ -147,6 +148,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
},
Expand Down
2 changes: 2 additions & 0 deletions core/corerepo/stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
}

0 comments on commit 7327afd

Please sign in to comment.