You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: del.go
    path of file: ./repos/kwok/pkg/kwokctl/cmd/hack/del
    
    the code of the file until where you have to start completion: /*
Copyright 2023 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the Licens
    
func runE(ctx context.Context, flags *flagpole, args []string) error {
	name := config.ClusterName(flags.Name)
	workdir := path.Join(config.ClustersDir, flags.Name)

	logger := log.FromContext(ctx)
	logger = logger.With("cluster", flags.Name)
	ctx = log.NewContext(ctx, logger)

	rt, err := runtime.DefaultRegistry.Load(ctx, name, workdir)
	if err != nil {
		return err
	}

	conf, err := rt.Config(ctx)
	if err != nil {
		return err
	}

	if rt.IsDryRun() {
		switch len(args) {
		case 1:
			if flags.Namespace == "" {
				dryrun.PrintMessage("kubectl delete %s --all -A", args[0])
			} else {
				dryrun.PrintMessage("kubectl delete %s --all -n %s", args[0], flags.Namespace)
			}
		case 2:
			if flags.Namespace == "" {
				dryrun.PrintMessage("kubectl delete %s %s", args[0], args[1])
			} else {
				dryrun.PrintMessage("kubectl delete %s %s -n %s", args[0], args[1], flags.Namespace)
			}
		default:
			if flags.Namespace == "" {
				dryrun.PrintMessage("kubectl delete all --all -A")
			} else {
				dryrun.PrintMessage("kubectl delete all -all -n %s", flags.Namespace)
			}
		}
		return nil
	}

	etcdclient, err := rt.GetEtcdClient(ctx)
	if err != nil {
		return err
	}

	var targetGvr schema.GroupVersionResource
	var targetName string
	var targetNamespace string
	if len(args) != 0 {
		kubeconfigPath := rt.GetWorkdirPath(runtime.InHostKubeconfigName)
		clientset, err := client.NewClientset("", kubeconfigPath)
		if err != nil {
			return err
		}

		dc, err := clientset.ToDiscoveryClient()
		if err != nil {
			return err
		}
		rl, err := dc.ServerPreferredResources()
		if err != nil {
			return err
		}

		resourceName := args[0]

		gvr, resource, err := client.MatchShortResourceName(rl, resourceName)
		if err != nil {
			return err
		}

		if resource.Namespaced {
			if flags.Namespace == "" {
				flags.Namespace = "default"
			}
		} else {
			if flags.Namespace != "" {
				return fmt.Errorf("resource %s is not namespaced", gvr)
			}
		}

		targetGvr = gvr
		targetNamespace = flags.Namespace
		if len(args) >= 2 {
			targetName = args[1]
		}
	}

	var count int
	var response func(kv *etcd.KeyValue) error
	if flags.Output == "key" {
		response = func(kv *etcd.KeyValue) error {
			count++
			fmt.Fprintf(os.Stdout, "%s\n", kv.Key)
			return nil
		}
	}

	opOpts := []etcd.OpOption{
		etcd.WithName(targetName, targetNamespace),
		etcd.WithGVR(targetGvr),
	}

	if response != nil {
		opOpts = append(opOpts,
			etcd.WithKeysOnly(),
			etcd.WithResponse(response),
		)
	}

	err = etcdclient.Delete(ctx, conf.Options.EtcdPrefix,
		opOpts...,
	)
	if err != nil {
		return err
	}

	if log.IsTerminal() && flags.Output == "key" {
		fmt.Fprintf(os.Stderr, "delete %d keys\n", count)
	}
	return nil
}