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: ports.go
    path of file: ./repos/devspace/cmd/list
    
    the code of the file until where you have to start completion: package list

import (
	"context"
	"encoding/json"
	"fmt"

	"github.com/loft-sh/devspace/cmd/flags"
	"github.com/loft-sh/devspace/pkg/util/factory"
	"github.com/loft-sh/devspace/pkg/util/log"
	"github.com/loft-sh/devspace/pkg/util/message"
	"github.com/pkg/errors"
	"github.com/spf13/cobra"
)

type portsCmd struct {
	*flags.GlobalFlags

	Output string
}

type jsonOutput struct {
	ImageSelector string `json:"imageSelector"`
	LabelSelector string `json:"labelSelector"`
	Port          string `json:"port"`
}

func newPortsCmd(f factory.Factory, globalFlags *flags.GlobalFlags) *cobra.Com
    
func newPortsCmd(f factory.Factory, globalFlags *flags.GlobalFlags) *cobra.Command {
	cmd := &portsCmd{GlobalFlags: globalFlags}

	portsCmd := &cobra.Command{
		Use:   "ports",
		Short: "Lists port forwarding configurations",
		Long: `
#######################################################
############### devspace list ports ###################
#######################################################
Lists the port forwarding configurations
#######################################################
	`,
		Args: cobra.NoArgs,
		RunE: func(cobraCmd *cobra.Command, args []string) error {
			return cmd.RunListPort(f, cobraCmd, args)
		}}

	portsCmd.Flags().StringVarP(&cmd.Output, "output", "o", "", "The output format of the command. Can be either empty or json")
	return portsCmd
}