bangs

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: Apache-2.0, BSD-3-Clause, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractBang

func ExtractBang(query string) string

ExtractBang extracts just the bang shortcut without full parsing

Types

type Bang

type Bang struct {
	Shortcut    string   `json:"shortcut" yaml:"shortcut"`
	Name        string   `json:"name" yaml:"name"`
	URL         string   `json:"url" yaml:"url"`
	Category    string   `json:"category" yaml:"category"`
	Description string   `json:"description,omitempty" yaml:"description,omitempty"`
	Icon        string   `json:"icon,omitempty" yaml:"icon,omitempty"`
	Aliases     []string `json:"aliases,omitempty" yaml:"aliases,omitempty"`
}

Bang represents a search bang redirect

type BangResult

type BangResult struct {
	Bang       *Bang
	Query      string
	TargetURL  string
	IsBangOnly bool // Query was just the bang with no search terms
}

BangResult represents the result of bang parsing

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages bangs from multiple sources

func NewManager

func NewManager() *Manager

NewManager creates a new bang manager with built-in defaults

func (*Manager) GetAll

func (m *Manager) GetAll() []*Bang

GetAll returns all available bangs (merged)

func (*Manager) GetBuiltins

func (m *Manager) GetBuiltins() []*Bang

GetBuiltins returns built-in bangs only

func (*Manager) GetByCategory

func (m *Manager) GetByCategory(category string) []*Bang

GetByCategory returns bangs filtered by category

func (*Manager) GetCategories

func (m *Manager) GetCategories() []string

GetCategories returns all unique categories

func (*Manager) IsBang

func (m *Manager) IsBang(query string) bool

IsBang checks if a query contains a bang

func (*Manager) Parse

func (m *Manager) Parse(query string) *BangResult

Parse parses a query for bang commands Returns nil if no bang found

func (*Manager) SetCustomBangs

func (m *Manager) SetCustomBangs(bangs []*Bang)

SetCustomBangs sets custom bangs from server configuration

func (*Manager) SetUserBangs

func (m *Manager) SetUserBangs(bangs []*Bang)

SetUserBangs sets user-specific bangs (from localStorage)

Jump to

Keyboard shortcuts

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