-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
commands: fix refs 'edges' option work #3007
Conversation
also change it to use format instead of separate variable License: MIT Signed-off-by: Jakub Sztandera <[email protected]>
if err != nil { | ||
res.SetError(err, cmds.ErrNormal) | ||
return | ||
} | ||
if edges { | ||
if format != "<dst>" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't format
be an empty string (rather than "<dst>"
) if it isn't provided?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no because: .Default("<dst>")
This has no tests for (edit: Since I've now confirmed that |
Interesting -- in 0.4.2, |
@@ -315,8 +322,6 @@ func (rw *RefWriter) WriteEdge(from, to key.Key, linkname string) error { | |||
s = strings.Replace(s, "<src>", from.B58String(), -1) | |||
s = strings.Replace(s, "<dst>", to.B58String(), -1) | |||
s = strings.Replace(s, "<linkname>", linkname, -1) | |||
case rw.PrintEdge: | |||
s = from.B58String() + " -> " + to.B58String() | |||
default: | |||
s += to.B58String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this default case? It would only trigger if --format
is explicitly set to the empty string, which seems like a corner case better handled by either an error, or actually printing an empty string for each edge, rather than overriding the explicit intention of the user.
LGTM |
also change it to use format instead of separate variable
Resolves #3001
License: MIT
Signed-off-by: Jakub Sztandera [email protected]