Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-unixfs
Commits
80dcc5d2
Commit
80dcc5d2
authored
Nov 13, 2014
by
Brian Tiger Chow
Committed by
Juan Batiz-Benet
Nov 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(2/version)
License: MIT Signed-off-by:
Brian Tiger Chow
<
brian@perfmode.com
>
parent
65eb1d86
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
core/commands2/version.go
core/commands2/version.go
+12
-12
No files found.
core/commands2/version.go
View file @
80dcc5d2
package
commands
package
commands
import
(
import
(
"fmt"
cmds
"github.com/jbenet/go-ipfs/commands"
cmds
"github.com/jbenet/go-ipfs/commands"
config
"github.com/jbenet/go-ipfs/config"
config
"github.com/jbenet/go-ipfs/config"
)
)
...
@@ -11,12 +13,16 @@ type VersionOutput struct {
...
@@ -11,12 +13,16 @@ type VersionOutput struct {
var
VersionCmd
=
&
cmds
.
Command
{
var
VersionCmd
=
&
cmds
.
Command
{
Helptext
:
cmds
.
HelpText
{
Helptext
:
cmds
.
HelpText
{
Tagline
:
"Outputs the current version of IPFS"
,
Tagline
:
"Shows ipfs version information"
,
ShortDescription
:
"Returns the version number of IPFS and exits."
,
ShortDescription
:
"Shows ipfs version information"
,
LongDescription
:
`ipfs version - Show ipfs version information.
Returns the current version of ipfs and exits.
`
,
},
},
Options
:
[]
cmds
.
Option
{
Options
:
[]
cmds
.
Option
{
cmds
.
BoolOption
(
"number"
,
"n"
,
"Only
output
the version number"
),
cmds
.
BoolOption
(
"number"
,
"n"
,
"Only
show
the version number"
),
},
},
Run
:
func
(
req
cmds
.
Request
)
(
interface
{},
error
)
{
Run
:
func
(
req
cmds
.
Request
)
(
interface
{},
error
)
{
return
&
VersionOutput
{
return
&
VersionOutput
{
...
@@ -26,21 +32,15 @@ var VersionCmd = &cmds.Command{
...
@@ -26,21 +32,15 @@ var VersionCmd = &cmds.Command{
Marshalers
:
cmds
.
MarshalerMap
{
Marshalers
:
cmds
.
MarshalerMap
{
cmds
.
Text
:
func
(
res
cmds
.
Response
)
([]
byte
,
error
)
{
cmds
.
Text
:
func
(
res
cmds
.
Response
)
([]
byte
,
error
)
{
v
:=
res
.
Output
()
.
(
*
VersionOutput
)
v
:=
res
.
Output
()
.
(
*
VersionOutput
)
s
:=
""
number
,
found
,
err
:=
res
.
Request
()
.
Option
(
"number"
)
.
Bool
()
number
,
found
,
err
:=
res
.
Request
()
.
Option
(
"number"
)
.
Bool
()
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
if
!
found
{
if
found
&&
number
{
number
=
false
return
[]
byte
(
fmt
.
Sprintln
(
v
.
Version
)),
nil
}
if
!
number
{
s
+=
"ipfs version "
}
}
s
+=
v
.
Version
return
[]
byte
(
fmt
.
Sprintf
(
"ipfs version %s
\n
"
,
v
.
Version
)),
nil
return
[]
byte
(
s
),
nil
},
},
},
},
Type
:
&
VersionOutput
{},
Type
:
&
VersionOutput
{},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment