cmd

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServiceUnavailable = errors.New("service unavailable")
	ErrDownloadNotFound   = errors.New("download not found")
	ErrNoDestinationPath  = errors.New("download has no destination path")
)
View Source
var (
	Version   = "dev"
	BuildTime = "unknown"
)

Version information - set via ldflags during build

View Source
var (
	GlobalPool             *download.WorkerPool
	GlobalProgressCh       chan any
	GlobalService          core.DownloadService
	GlobalLifecycleCleanup func()

	GlobalLifecycle *processing.LifecycleManager
)

Globals for Unified Backend

Functions

func AcquireLock

func AcquireLock() (bool, error)

AcquireLock attempts to acquire the single instance lock. Returns true if the lock was acquired (this is the master instance). Returns false if the lock is already held (another instance is running). Returns an error if the locking process failed unexpectedly.

func Execute

func Execute() error

Execute adds all child commands to the root command and sets flags appropriately.

func ExecuteAPIAction

func ExecuteAPIAction(rawID, endpoint, method, successMsg string) error

ExecuteAPIAction connects to the server, resolves the ID, and sends a request.

func GetRemoteDownloads

func GetRemoteDownloads(baseURL string, token string) ([]types.DownloadStatus, error)

GetRemoteDownloads fetches all downloads from the running server

func ParseURLArg

func ParseURLArg(arg string) (string, []string)

ParseURLArg parses a command line argument that might contain comma-separated mirrors Returns the primary URL and a list of all mirrors (including the primary)

func ReleaseLock

func ReleaseLock() error

ReleaseLock releases the lock if it is held by this instance.

func StartHeadlessConsumer

func StartHeadlessConsumer()

StartHeadlessConsumer starts a goroutine to consume progress messages and log to stdout

Types

type DownloadRequest

type DownloadRequest struct {
	URL                  string            `json:"url"`
	Filename             string            `json:"filename,omitempty"`
	Path                 string            `json:"path,omitempty"`
	RelativeToDefaultDir bool              `json:"relative_to_default_dir,omitempty"`
	Mirrors              []string          `json:"mirrors,omitempty"`
	SkipApproval         bool              `json:"skip_approval,omitempty"` // Extension validated request, skip TUI prompt
	Headers              map[string]string `json:"headers,omitempty"`       // Custom HTTP headers from browser (cookies, auth, etc.)
	IsExplicitCategory   bool              `json:"is_explicit_category,omitempty"`
}

DownloadRequest represents a download request from the browser extension

type InstanceLock

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

InstanceLock wraps the file locking mechanism

Jump to

Keyboard shortcuts

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