config

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Zoom6Max = 64
	Zoom5Max = 32
	Zoom4Max = 16
	Zoom3Max = 8
	Zoom2Max = 4
)
View Source
const (
	FlagCompletion  = "completion"
	FlagYear        = "year"
	FlagNoCrop      = "no-crop"
	FlagTileMinX    = "tile-min-x"
	FlagTileMaxX    = "tile-max-x"
	FlagTileMinY    = "tile-min-y"
	FlagTileMaxY    = "tile-max-y"
	FlagZoom        = "zoom"
	FlagParallelism = "parallelism"
	FlagFormat      = "format"
	FlagCompression = "compression"

	ShellBash       = "bash"
	ShellZsh        = "zsh"
	ShellFish       = "fish"
	ShellPowerShell = "powershell"
)
View Source
const URLTemplate = "https://tiles.telegeography.com/maps/submarine-cable-map-%d/%d/%d/%d.%s"

Variables

View Source
var (
	ErrMaxXTooLarge = errors.New("tile max x exceeds zoom level")
	ErrMaxYTooLarge = errors.New("tile max y exceeds zoom level")
)
View Source
var ErrInvalidZoom = errors.New("invalid zoom")
View Source
var ErrMissingConfig = errors.New("command missing config")
View Source
var ErrMissingYear = errors.New("could not find year")
View Source
var ErrNoFormat = errors.New("could not discover file format")

Functions

func CompressionLevelStrings

func CompressionLevelStrings() []string

CompressionLevelStrings returns a slice of all String values of the enum

func InitLog

func InitLog()

func NewContext

func NewContext(ctx context.Context, conf *Config) context.Context

Types

type CompressionLevel

type CompressionLevel int
const (
	CompressionDefault CompressionLevel = iota
	CompressionNone
	CompressionFast
	CompressionBest
)

func CompressionLevelString

func CompressionLevelString(s string) (CompressionLevel, error)

CompressionLevelString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func CompressionLevelValues

func CompressionLevelValues() []CompressionLevel

CompressionLevelValues returns all values of the enum

func (CompressionLevel) IsACompressionLevel

func (i CompressionLevel) IsACompressionLevel() bool

IsACompressionLevel returns "true" if the value is listed in the enum definition. "false" otherwise

func (CompressionLevel) MarshalText

func (i CompressionLevel) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for CompressionLevel

func (*CompressionLevel) Set

func (c *CompressionLevel) Set(s string) error

func (CompressionLevel) String

func (i CompressionLevel) String() string

func (*CompressionLevel) ToPNG

func (*CompressionLevel) Type

func (c *CompressionLevel) Type() string

func (*CompressionLevel) UnmarshalText

func (i *CompressionLevel) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for CompressionLevel

type Config

type Config struct {
	Completion  string
	Year        int
	TileSize    int
	NoCrop      bool
	Tiles       image.Rectangle
	Zoom        int
	Parallelism int
	Format      string
	Compression CompressionLevel
}

func FromContext

func FromContext(ctx context.Context) (*Config, bool)

func Load

func Load(ctx context.Context, cmd *cobra.Command) (*Config, error)

func New

func New() *Config

func (*Config) CheckYear

func (c *Config) CheckYear(ctx context.Context) error

func (*Config) DetermineOffsetsByYear

func (c *Config) DetermineOffsetsByYear() error

func (*Config) FindFormat

func (c *Config) FindFormat(ctx context.Context) error

func (*Config) MaxForZoom

func (c *Config) MaxForZoom() (image.Point, error)

func (*Config) OutputHeight

func (c *Config) OutputHeight() int

func (*Config) OutputWidth

func (c *Config) OutputWidth() int

func (*Config) RegisterCompletions

func (c *Config) RegisterCompletions(cmd *cobra.Command)

func (*Config) RegisterFlags

func (c *Config) RegisterFlags(cmd *cobra.Command)

func (*Config) TileCount

func (c *Config) TileCount() int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL