Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Default to diag cmd #2664

Merged
merged 1 commit into from
May 13, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions core/commands/diag.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ type DiagnosticConnection struct {
var (
visD3 = "d3"
visDot = "dot"
visFmts = []string{visD3, visDot}
visText = "text"
visFmts = []string{visD3, visDot, visText}
)

type DiagnosticPeer struct {
Expand Down Expand Up @@ -66,8 +67,8 @@ timeout. If the timeout is too small, some peers may not be reached.
The default timeout is 20 seconds.

The 'vis' option may be used to change the output format.
Four formats are supported:
* plain text - Easy to read. Default.
Three formats are supported:
* text - Easy to read. Default.
* d3 - json ready to be fed into d3view
* dot - graphviz format

Expand All @@ -81,13 +82,13 @@ open the following link:

http://gateway.ipfs.io/ipfs/QmbesKpGyQGd5jtJFUGEB1ByPjNFpukhnKZDnkfxUiKn38/chord#<your hash>

The dot format can be fed into graphviz and other programs
The 'dot' format can be fed into graphviz and other programs
that consume the dot format to generate graphs of the network.
`,
},

Options: []cmds.Option{
cmds.StringOption("vis", "Output vis. One of: "+strings.Join(visFmts, ", ")),
cmds.StringOption("vis", "Output format. One of: "+strings.Join(visFmts, ", ")).Default(visText),
},

Run: func(req cmds.Request, res cmds.Response) {
Expand Down Expand Up @@ -141,13 +142,16 @@ that consume the dot format to generate graphs of the network.
return
}
res.SetOutput(io.Reader(buf))
default:
case visText:
output, err := stdDiagOutputMarshal(standardDiagOutput(info))
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
res.SetOutput(output)
default:
res.SetError(err, cmds.ErrNormal)
return
}
},
}
Expand Down