-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
Enhancement: in REPL mode allow user to specify path to file for bytes field #280
Enhancement: in REPL mode allow user to specify path to file for bytes field #280
Conversation
Codecov Report
@@ Coverage Diff @@
## master #280 +/- ##
==========================================
- Coverage 82.57% 82.47% -0.10%
==========================================
Files 57 57
Lines 3139 3156 +17
==========================================
+ Hits 2592 2603 +11
- Misses 313 316 +3
- Partials 234 237 +3 |
the build is failed because of the additional \r byte in windows files. |
e9e25bb
to
d6b5032
Compare
@@ -1,16 +1,86 @@ | |||
package proto_test | |||
package proto |
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.
I dropped the _test
because I needed access to the internal function I wanted to test.
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.
Sorry for the delay in replying.
It's almost perfect! I have only pointed out a few minor points.
fill/proto/interactive_filler.go
Outdated
@@ -213,7 +217,7 @@ func (f *InteractiveFiller) inputField(dmsg *dynamic.Message, field *desc.FieldD | |||
f.state.color.Next() | |||
default: // Normal fields. | |||
f.prompt.SetPrefix(f.makePrefix(field)) | |||
v, err := f.inputPrimitiveField(field) | |||
v, err := f.inputPrimitiveField(descriptor.FieldDescriptorProto_Type(descriptor.FieldDescriptorProto_Type_value[field.GetType().String()])) |
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.
v, err := f.inputPrimitiveField(descriptor.FieldDescriptorProto_Type(descriptor.FieldDescriptorProto_Type_value[field.GetType().String()])) | |
v, err := f.inputPrimitiveField(field.GetType()) |
fill/proto/interactive_filler.go
Outdated
absPath, err := filepath.Abs(path) | ||
if err != nil { | ||
return nil, err | ||
} |
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.
These lines are unnecessary because ioutil.ReadFile
also accepts relative paths.
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.
didn't know that :)
@@ -301,7 +305,7 @@ func (f *InteractiveFiller) inputRepeatedField(dmsg *dynamic.Message, field *des | |||
|
|||
// inputPrimitiveField reads an input and converts it to a Go type. | |||
// If CTRL+d is entered, inputPrimitiveField returns io.EOF. | |||
func (f *InteractiveFiller) inputPrimitiveField(field *desc.FieldDescriptor) (interface{}, error) { | |||
func (f *InteractiveFiller) inputPrimitiveField(fieldType descriptor.FieldDescriptorProto_Type) (interface{}, error) { |
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.
👍
type testPrompt struct { | ||
input string | ||
} |
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.
Can you embed prompt.Prompt
and remove methods other than Input
?
type testPrompt struct { | |
input string | |
} | |
type testPrompt struct { | |
prompt.Prompt | |
input string | |
} |
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.
great suggestion thank you!
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.
LGTM 👍
Thanks for your contribution!
see Issue: #279