@@ -45,7 +45,7 @@ type nerdctlCommandCreator struct {
4545
4646type (
4747 argHandler func (systemDeps NerdctlCommandSystemDeps , fc * config.Finch , args []string , index int ) error
48- commandHandler func (systemDeps NerdctlCommandSystemDeps , fc * config.Finch , cmdName * string , args * []string ) error
48+ commandHandler func (systemDeps NerdctlCommandSystemDeps , fc * config.Finch , cmdName * string , args * []string , inspectType * string ) error
4949)
5050
5151func newNerdctlCommandCreator (
@@ -256,7 +256,7 @@ func handleDockerBuildLoad(_ NerdctlCommandSystemDeps, fc *config.Finch, nerdctl
256256 return nil
257257}
258258
259- func handleBuildx (_ NerdctlCommandSystemDeps , fc * config.Finch , cmdName * string , args * []string ) error {
259+ func handleBuildx (_ NerdctlCommandSystemDeps , fc * config.Finch , cmdName * string , args * []string , _ * string ) error {
260260 if fc == nil || ! fc .DockerCompat {
261261 return nil
262262 }
@@ -279,7 +279,7 @@ func handleBuildx(_ NerdctlCommandSystemDeps, fc *config.Finch, cmdName *string,
279279 return nil
280280}
281281
282- func handleDockerCompatInspect (_ NerdctlCommandSystemDeps , fc * config.Finch , cmdName * string , args * []string ) error {
282+ func handleDockerCompatInspect (_ NerdctlCommandSystemDeps , fc * config.Finch , cmdName * string , args * []string , inspectType * string ) error {
283283 if fc == nil || ! fc .DockerCompat {
284284 return nil
285285 }
@@ -289,10 +289,10 @@ func handleDockerCompatInspect(_ NerdctlCommandSystemDeps, fc *config.Finch, cmd
289289 }
290290
291291 modeDockerCompat := `--mode=dockercompat`
292- inspectType := ""
293292 sizeArg := ""
294293 savedArgs := []string {}
295294 skip := false
295+ * inspectType = ""
296296
297297 for idx , arg := range * args {
298298 if skip {
@@ -301,13 +301,13 @@ func handleDockerCompatInspect(_ NerdctlCommandSystemDeps, fc *config.Finch, cmd
301301 }
302302
303303 if (arg == "--type" ) && (idx < len (* args )- 1 ) {
304- inspectType = (* args )[idx + 1 ]
304+ * inspectType = (* args )[idx + 1 ]
305305 skip = true
306306 continue
307307 }
308308
309309 if strings .Contains (arg , "--type" ) && strings .Contains (arg , "=" ) {
310- inspectType = strings .Split (arg , "=" )[1 ]
310+ * inspectType = strings .Split (arg , "=" )[1 ]
311311 continue
312312 }
313313
@@ -319,7 +319,7 @@ func handleDockerCompatInspect(_ NerdctlCommandSystemDeps, fc *config.Finch, cmd
319319 savedArgs = append (savedArgs , arg )
320320 }
321321
322- switch inspectType {
322+ switch * inspectType {
323323 case "image" :
324324 * cmdName = "image inspect"
325325 * args = append ([]string {modeDockerCompat }, savedArgs ... )
@@ -336,8 +336,9 @@ func handleDockerCompatInspect(_ NerdctlCommandSystemDeps, fc *config.Finch, cmd
336336 case "" :
337337 * cmdName = "inspect"
338338 * args = append ([]string {modeDockerCompat }, savedArgs ... )
339+ * inspectType = "container"
339340 default :
340- return fmt .Errorf ("unsupported inspect type: %s" , inspectType )
341+ return fmt .Errorf ("unsupported inspect type: %s" , * inspectType )
341342 }
342343
343344 return nil
0 commit comments