-
Notifications
You must be signed in to change notification settings - Fork 565
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
Refactor the network command flagging process #1822
Conversation
1ba00f9
to
71b56ae
Compare
71b56ae
to
597746e
Compare
Force-pushed to change the |
597746e
to
a326bcd
Compare
All suggestions have been resolved. thanks❤️ |
The code conflict should be removed before merged |
a326bcd
to
9f5c5b6
Compare
Force-pushed to resolve code conflicts. |
@miles170 maybe you should resolve conflict again |
9f5c5b6
to
96253d8
Compare
rebased |
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, on CI green, Thanks
return network.Create(types.NetworkCreateCommandOptions{ | ||
GOptions: globalOptions, | ||
CreateOptions: netutil.CreateOptions{ | ||
Name: name, | ||
Driver: driver, | ||
Options: strutil.ConvertKVStringsToMap(opts), | ||
IPAMDriver: ipamDriver, | ||
IPAMOptions: strutil.ConvertKVStringsToMap(ipamOpts), | ||
Subnet: subnetStr, | ||
Gateway: gatewayStr, | ||
IPRange: ipRangeStr, | ||
Labels: labels, | ||
}, | ||
}, cmd.OutOrStdout()) |
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.
nits: maybe we can keep the same code style with other command like https://github.com/containerd/nerdctl/blob/main/cmd/nerdctl/namespace_create.go#L39-L52(put the option construct process in a single function)
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 think it should be fine for now, since most the commandAction
simply calls processCommandOption
and command.Command
(e.g., network.Create
) in pkg
side.
Later if we decide to move other non-core logic (those more related to cmd than core, e.g., option filtering/postprocess, formatting, outputting, etc) back to cmd
side, we can put them in separate sub funcs.
Mode: mode, | ||
Format: format, | ||
Networks: args, | ||
}, cmd.OutOrStdout()) |
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.
same above
return network.Create(types.NetworkCreateCommandOptions{ | ||
GOptions: globalOptions, | ||
CreateOptions: netutil.CreateOptions{ | ||
Name: name, | ||
Driver: driver, | ||
Options: strutil.ConvertKVStringsToMap(opts), | ||
IPAMDriver: ipamDriver, | ||
IPAMOptions: strutil.ConvertKVStringsToMap(ipamOpts), | ||
Subnet: subnetStr, | ||
Gateway: gatewayStr, | ||
IPRange: ipRangeStr, | ||
Labels: labels, | ||
}, | ||
}, cmd.OutOrStdout()) |
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 think it should be fine for now, since most the commandAction
simply calls processCommandOption
and command.Command
(e.g., network.Create
) in pkg
side.
Later if we decide to move other non-core logic (those more related to cmd than core, e.g., option filtering/postprocess, formatting, outputting, etc) back to cmd
side, we can put them in separate sub funcs.
Signed-off-by: Miles Liu <miles@bung.cc>
96253d8
to
b726a3a
Compare
All suggestions except discussion_r1072302635 have been resolved. thanks❤️ |
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 for now!
See #1680