func (cmd Cmd) Run(ctx context.Context, osArgs []string, version string) int {
	rootCmd := cmd.newRootCmd()
	rootCmd.SilenceErrors = true
	rootCmd.SilenceUsage = true
	rootCmd.Version = version
	rootCmd.SetArgs(osArgs[1:])
	if err := rootCmd.ExecuteContext(ctx); err != nil {
		if errors.Is(err, context.Canceled) {
			klog.V(1).Infof("terminating: %s", err)
			return 0
		}
		klog.Infof("error: %s", err)
		klog.V(1).Infof("stacktrace: %+v", err)
		return 1
	}
	return 0
}
Run parses the arguments and executes the corresponding use-case.
package cmd
import (
	"context"
	"errors"
	"flag"
	"fmt"
	"net"
	"strconv"
	"strings"
	"github.com/google/wire"
	"github.com/int128/kubectl-external-forward/pkg/externalforwarder"
	"github.com/int128/kubectl-external-forward/pkg/tunnel"
	"github.com/spf13/cobra"
	"github.com/spf13/pflag"
	"k8s.io/cli-runtime/pkg/genericclioptions"
	"k8s.io/klog/v2"
)
const (
	defaultImage = "ghcr.io/int128/kubectl-external-forward/mirror/envoy"
)
var Set = wire.NewSet(
	wire.Struct(new(Cmd), "*"),
	wire.Bind(new(Interface), new(*Cmd)),
)
type Interface interface {
	Run(ctx context.Context, osArgs []string, version string) int
}
type Cmd struct {
	ExternalForwarder externalforwarder.Interface
}