providers

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2024 License: MIT Imports: 8 Imported by: 737

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Providers map[string]Provider

Providers tracks loaded providers.

Functions

func AddProvider

func AddProvider(name string, provider Provider)

AddProvider should be called within your provider's init() func. This will register the provider so it can be used.

func DisplayProviders

func DisplayProviders(verbose bool) string

DisplayProviders displays all the loaded providers.

func DisplayTags added in v0.5.0

func DisplayTags(verbose bool) string

DisplayTags displays all the available tags.

func ExpandProvider added in v0.1.8

func ExpandProvider(provider string) (string, error)

ExpandProvider expands the passed in provider to the full value.

func ExpandTag added in v0.5.0

func ExpandTag(tag string) (string, error)

ExpandTag expands the passed in tag to the full value.

func Language added in v0.2.1

func Language() string

Language returns the users language code. Eg. "en", "es", etc

func ProviderNames added in v0.1.8

func ProviderNames(verbose bool) []string

ProviderNames returns a sorted slice of provider names applying both the whitelist and then the blacklist.

func Region added in v0.2.1

func Region() string

Region returns the users region code. Eg. "US", "GB", etc

func Search(binary string, p string, t string, q string, userProvider bool, outputOnly bool, verbose bool) error

Search builds a search URL and opens it in your browser.

func SetBlacklist added in v0.4.0

func SetBlacklist(b []string)

SetBlacklist filters out unneeded providers.

func SetClientLocale added in v0.4.3

func SetClientLocale(locale string)

SetClientLocale sets the locale of the client connecting to the web server.

func SetWhitelist added in v0.4.0

func SetWhitelist(w []string)

SetWhitelist sets an exact list of supported providers.

func TagNames added in v0.5.0

func TagNames(verbose bool) []string

TagNames returns a deduped and sorted slice of tag names.

Types

type CustomProvider added in v0.4.0

type CustomProvider struct {
	Name    string   `json:"name"`
	URL     string   `json:"url"`
	TagList []string `json:"tags"`
}

CustomProvider is used for Config based providers.

func (*CustomProvider) BuildURI added in v0.4.0

func (c *CustomProvider) BuildURI(q string) string

BuildURI builds the URI for custom providers.

func (*CustomProvider) Tags added in v0.5.0

func (c *CustomProvider) Tags() []string

Tags returns the tags relevant to this provider.

func (*CustomProvider) Valid added in v0.4.0

func (c *CustomProvider) Valid() error

Valid checks if the custom provider is setup correctly.

type Provider

type Provider interface {
	BuildURI(string) string
	Tags() []string
}

Provider interface provides a way to build the URI for each provider.

func GetProvidersByTag added in v0.5.2

func GetProvidersByTag(tag string) []Provider

GetProvidersByTag gets all providers with a specific tag.

Jump to

Keyboard shortcuts

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