@@ -7,11 +7,13 @@ import (
7
7
8
8
cmds "github.com/ipfs/go-ipfs/commands"
9
9
config "github.com/ipfs/go-ipfs/repo/config"
10
+ fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo"
10
11
)
11
12
12
13
type VersionOutput struct {
13
14
Version string
14
- Commit string
15
+ Commit string
16
+ Repo string
15
17
}
16
18
17
19
var VersionCmd = & cmds.Command {
@@ -23,17 +25,28 @@ var VersionCmd = &cmds.Command{
23
25
Options : []cmds.Option {
24
26
cmds .BoolOption ("number" , "n" , "Only show the version number" ),
25
27
cmds .BoolOption ("commit" , "Show the commit hash" ),
28
+ cmds .BoolOption ("repo" , "Show repo version" ),
26
29
},
27
30
Run : func (req cmds.Request , res cmds.Response ) {
28
31
res .SetOutput (& VersionOutput {
29
32
Version : config .CurrentVersionNumber ,
30
- Commit : config .CurrentCommit ,
33
+ Commit : config .CurrentCommit ,
34
+ Repo : fsrepo .RepoVersion ,
31
35
})
32
36
},
33
37
Marshalers : cmds.MarshalerMap {
34
38
cmds .Text : func (res cmds.Response ) (io.Reader , error ) {
35
39
v := res .Output ().(* VersionOutput )
36
40
41
+ repo , _ , err := res .Request ().Option ("repo" ).Bool ()
42
+ if err != nil {
43
+ return nil , err
44
+ }
45
+
46
+ if repo {
47
+ return strings .NewReader (v .Repo + "\n " ), nil
48
+ }
49
+
37
50
commit , found , err := res .Request ().Option ("commit" ).Bool ()
38
51
commitTxt := ""
39
52
if err != nil {
0 commit comments