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

import (
	"fmt"
	"net/url"
	"os"
	"strings"

	"github.com/remeh/sizedwaitgroup"
	"github.com/sensepost/gowitness/lib"
	"github.com/spf13/cobra"
	"github.com/tomsteele/go-nmap"
)

// nmapCmd represents the nmap command
var nmapCmd = &cobra.Command{
	Use:   "nmap",
	Short: "Screenshot services from an Nmap XML file",
	Long: `Screenshot services from an Nmap XML file.

When performing an Nmap scan, specify the -oX nmap.xml flag to store
data in an XML formatted file that gowitness can parse.

Running this command without specifying any --services flags means it
will try and screenshot
    
func getNmapURLs() (urls []string, err error) {

	xml, err := os.ReadFile(options.NmapFile)
	if err != nil {
		return
	}

	nmapXML, err := nmap.Parse(xml)
	if err != nil {
		return
	}

	// parse the data and generate URL's
	for _, host := range nmapXML.Hosts {
		for _, address := range host.Addresses {

			if !lib.SliceContainsString([]string{"ipv4", "ipv6"}, address.AddrType) {
				break
			}

			for _, port := range host.Ports {
				// skip port if the --open flag has been set and the port is filtered/closed
				if options.NmapOpenPortsOnly && port.State.State != "open" {
					continue
				}

				// skip port if the port id does not match the provided ports to filter
				if len(options.NmapPorts) > 0 && !lib.SliceContainsInt(options.NmapPorts, port.PortId) {
					continue
				}

				// skip port if the service name flag has been set and the service name does not match the filter
				if len(options.NmapService) > 0 && !lib.SliceContainsString(options.NmapService, port.Service.Name) {
					continue
				}

				// skip port if the service contains flag has been set and the service name does not contain the filter
				if len(options.NmapServiceContains) > 0 && !strings.Contains(port.Service.Name, options.NmapServiceContains) {
					continue
				}

				// add the hostnames if the option has been set
				if options.NmapScanHostnames {
					for _, hn := range host.Hostnames {
						urls = append(urls, buildURI(hn.Name, port.PortId)...)
					}
				}

				// process the port successfully
				urls = append(urls, buildURI(address.Addr, port.PortId)...)
			}
		}
	}

	return
}