Skip to content

Commit 7327afd

Browse files
committed
Adds repo version info to repo stat command
addresses ipfs#2571 License: MIT Signed-off-by: Mike Pfister <[email protected]>
1 parent cb41925 commit 7327afd

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

core/commands/repo.go

+2
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ set of stored objects and print repo statistics. It outputs to stdout:
105105
NumObjects int Number of objects in the local repo.
106106
RepoPath string The path to the repo being currently used.
107107
RepoSize int Size in bytes that the repo is currently taking.
108+
Version string The repo version
108109
`,
109110
},
110111
Run: func(req cmds.Request, res cmds.Response) {
@@ -147,6 +148,7 @@ RepoSize int Size in bytes that the repo is currently taking.
147148
fmt.Fprintf(buf, "RepoSize \t %d\n", stat.RepoSize)
148149
}
149150
fmt.Fprintf(buf, "RepoPath \t %s\n", stat.RepoPath)
151+
fmt.Fprintf(buf, "Version \t %s\n", stat.Version)
150152

151153
return buf, nil
152154
},

core/corerepo/stat.go

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ type Stat struct {
1010
NumObjects uint64
1111
RepoSize uint64 // size in bytes
1212
RepoPath string
13+
Version string
1314
}
1415

1516
func RepoStat(n *core.IpfsNode, ctx context.Context) (*Stat, error) {
@@ -39,5 +40,6 @@ func RepoStat(n *core.IpfsNode, ctx context.Context) (*Stat, error) {
3940
NumObjects: count,
4041
RepoSize: usage,
4142
RepoPath: path,
43+
Version: "fs-repo@" + fsrepo.RepoVersion,
4244
}, nil
4345
}

0 commit comments

Comments
 (0)