func (d *Distro) Set(s string) error {
	for _, e := range distros {
		if s == string(e) {
			*d = Distro(e)
			return nil
		}
	}
	return errors.New("unsupported distro")
}
Set implements flag.Value.
package img
import (
	"archive/zip"
	"bytes"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"net/http"
	"os"
	"path/filepath"
	"regexp"
	"sort"
	"strings"
	"github.com/ulikunitz/xz"
)
type Manufacturer string
const (
	HardKernel Manufacturer = "hardkernel"
	Raspberry Manufacturer = "raspberrypi"
	NextThingCo Manufacturer = "ntc"
)
func (m *Manufacturer) String() string {
	return string(*m)
}
var manufacturers = []Manufacturer{HardKernel, NextThingCo, Raspberry}
func (m *Manufacturer) Set(s string) error {
	for _, e := range manufacturers {
		if s == string(e) {
			*m = Manufacturer(e)
			return nil
		}
	}
	return errors.New("unsupported manufacturer")
}
func ManufacturerHelp() string {
	var names []string
	for _, e := range manufacturers {
		names = append(names, string(e))
	}
	sort.Strings(names)
	return fmt.Sprintf("Board manufacturer: %s", strings.Join(names, ", "))
}
func (m *Manufacturer) boards() []Board {
	switch *m {
	case HardKernel:
		return []Board{OdroidC1}
	case NextThingCo:
		return []Board{CHIP, CHIPPro, PocketCHIP}
	case Raspberry:
		return []Board{RaspberryPi}
	default:
		return nil
	}
}
func (m *Manufacturer) distros() []Distro {
	switch *m {
	case HardKernel:
		return []Distro{Ubuntu}
	case NextThingCo:
		return []Distro{Debian}
	case Raspberry:
		return []Distro{Raspbian, Ubuntu}
	default:
		return nil
	}
}
type Board string
const (
	OdroidC1 Board = "odroidc1"
	RaspberryPi Board = "raspberrypi"
	CHIP Board = "chip"
	CHIPPro Board = "chippro"
	PocketCHIP Board = "pocketchip"
)
var boards = []Board{OdroidC1, RaspberryPi, CHIP, CHIPPro, PocketCHIP}
func (b *Board) String() string {
	return string(*b)
}
func (b *Board) Set(s string) error {
	for _, e := range boards {
		if s == string(e) {
			*b = Board(e)
			return nil
		}
	}
	return errors.New("unsupported board")
}
func BoardHelp() string {
	var names []string
	for _, e := range boards {
		names = append(names, string(e))
	}
	sort.Strings(names)
	return fmt.Sprintf("Boards: %s", strings.Join(names, ", "))
}
type Distro string
const (
	Debian Distro = "debian"
	Raspbian Distro = "raspbian"
	Ubuntu Distro = "ubuntu"
)
var distros = []Distro{Debian, Raspbian, Ubuntu}
func (d *Distro) String() string {
	return string(*d)
}