cmd

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 38 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KnownCommands = []CommandDecl{

	{Method: "goleo:getOS", ReturnType: "{ os: string; arch: string; name: string; version?: string }", Description: "Get OS information"},
	{Method: "goleo:getPlatform", ReturnType: "{ platform: string; isMobile: boolean; isDesktop: boolean; isBrowser: boolean }", Description: "Get platform info"},
	{Method: "goleo:getArch", ReturnType: "string", Description: "Get CPU architecture"},
	{Method: "goleo:getEnv", Args: "{ key: string }", ReturnType: "string", Description: "Get environment variable"},
	{Method: "goleo:openURL", Args: "{ url: string }", ReturnType: "void", Description: "Open URL in browser"},
	{Method: "goleo:notify", Args: "{ title: string; body?: string }", ReturnType: "void", Description: "Send notification"},
	{Method: "goleo:notificationPermissionGranted", ReturnType: "boolean", Description: "Check notification permission"},
	{Method: "goleo:requestNotificationPermission", ReturnType: "'granted' | 'denied' | 'default'", Description: "Request notification permission"},
	{Method: "goleo:showMessage", Args: "{ title: string; message: string }", ReturnType: "void", Description: "Log a message"},

	{Method: "goleo:clipboardReadText", ReturnType: "{ text: string }", Description: "Read text from clipboard", Feature: "Clipboard"},
	{Method: "goleo:clipboardWriteText", Args: "{ text: string }", ReturnType: "void", Description: "Write text to clipboard", Feature: "Clipboard"},

	{Method: "goleo:dialogOpenFile", Args: "{ title?: string; defaultPath?: string; filters?: { name: string; patterns: string[] }[]; multiple?: boolean }", ReturnType: "string[]", Description: "Open file dialog", Feature: "Dialogs"},
	{Method: "goleo:dialogSaveFile", Args: "{ title?: string; defaultPath?: string; filters?: { name: string; patterns: string[] }[] }", ReturnType: "string", Description: "Save file dialog", Feature: "Dialogs"},
	{Method: "goleo:dialogSelectFolder", Args: "{ title?: string; defaultPath?: string }", ReturnType: "string", Description: "Select folder dialog", Feature: "Dialogs"},
	{Method: "goleo:dialogShowMessage", Args: "{ title?: string; message: string; icon?: 'info' | 'warning' | 'error' | 'question'; buttons?: string[] }", ReturnType: "{ button: string }", Description: "Show message box", Feature: "Dialogs"},
	{Method: "goleo:dialogShowPrompt", Args: "{ title?: string; message: string; defaultValue?: string }", ReturnType: "string", Description: "Show input prompt", Feature: "Dialogs"},

	{Method: "goleo:fsReadTextFile", Args: "{ path: string }", ReturnType: "string", Description: "Read text file", Feature: "FileSystem"},
	{Method: "goleo:fsWriteTextFile", Args: "{ path: string; content: string }", ReturnType: "void", Description: "Write text file", Feature: "FileSystem"},
	{Method: "goleo:fsReadBinaryFile", Args: "{ path: string }", ReturnType: "{ data: string }", Description: "Read binary file (data is base64-encoded)", Feature: "FileSystem"},
	{Method: "goleo:fsWriteBinaryFile", Args: "{ path: string; data: string }", ReturnType: "void", Description: "Write binary file (data must be base64-encoded)", Feature: "FileSystem"},
	{Method: "goleo:fsListDir", Args: "{ path: string }", ReturnType: "{ name: string; path: string; isDir: boolean; size: number; modTime: string }[]", Description: "List directory contents", Feature: "FileSystem"},
	{Method: "goleo:fsDelete", Args: "{ path: string }", ReturnType: "void", Description: "Delete file or directory", Feature: "FileSystem"},
	{Method: "goleo:fsAppDataDir", Args: "{ appName?: string }", ReturnType: "string", Description: "Get app data directory", Feature: "FileSystem"},
	{Method: "goleo:fsHomeDir", ReturnType: "string", Description: "Get user home directory", Feature: "FileSystem"},

	{Method: "goleo:batteryGetInfo", ReturnType: "{ level: number; charging: boolean; chargingTime?: number; dischargingTime?: number }", Description: "Get battery status information", Feature: "Battery"},

	{Method: "goleo:share", Args: "{ title?: string; text?: string; url?: string }", ReturnType: "void", Description: "Open the native share sheet", Feature: "Share"},

	{Method: "goleo:storeGet", Args: "{ key: string }", ReturnType: "{ value: unknown; found: boolean }", Description: "Read a value from the key/value store"},
	{Method: "goleo:storeSet", Args: "{ key: string; value: unknown }", ReturnType: "void", Description: "Write a value to the key/value store"},
	{Method: "goleo:storeDelete", Args: "{ key: string }", ReturnType: "void", Description: "Delete a key from the store"},
	{Method: "goleo:storeKeys", ReturnType: "string[]", Description: "List all keys in the store"},
	{Method: "goleo:storeClear", ReturnType: "void", Description: "Clear all keys from the store"},

	{Method: "goleo:quit", ReturnType: "void", Description: "Request a graceful app shutdown (desktop)"},

	{Method: "goleo:windowOpen", Args: "{ title?: string; width?: number; height?: number; url?: string; path?: string; exitOnClose?: boolean }", ReturnType: "{ id: number }", Description: "Open an additional window (child process)"},
	{Method: "goleo:windowClose", Args: "{ id: number }", ReturnType: "void", Description: "Close a window by id"},
	{Method: "goleo:windowList", ReturnType: "{ ids: number[] }", Description: "List open window ids"},

	{Method: "goleo:setMenu", Args: "{ items: MenuItemSpec[] }", ReturnType: "void", Description: "Set the application menu"},

	{Method: "goleo:capabilities", ReturnType: "{ windowing: boolean; tray: boolean; menu: boolean }", Description: "Report supported desktop capabilities"},

	{Method: "goleo:microphonePermission", ReturnType: "{ granted: boolean }", Description: "Check microphone permission", Feature: "Microphone"},
	{Method: "goleo:microphoneRequestPermission", ReturnType: "{ status: string }", Description: "Request microphone permission", Feature: "Microphone"},

	{Method: "goleo:autostartEnable", ReturnType: "void", Description: "Register the app to launch on login"},
	{Method: "goleo:autostartDisable", ReturnType: "void", Description: "Remove the launch-on-login entry"},
	{Method: "goleo:autostartIsEnabled", ReturnType: "{ enabled: boolean }", Description: "Check if launch-on-login is registered"},

	{Method: "goleo:initialURL", ReturnType: "{ url: string }", Description: "The URL the app was launched with (deep link), or empty"},

	{Method: "goleo:updaterCheck", ReturnType: "{ available: boolean; version?: string; notes?: string }", Description: "Check for an available update"},
	{Method: "goleo:updaterApply", ReturnType: "void", Description: "Download and apply the latest update, then relaunch"},

	{Method: "goleo:wakeLockRequest", Args: "{ type?: string }", ReturnType: "void", Description: "Request a wake lock to keep the screen on", Feature: "WakeLock"},
	{Method: "goleo:wakeLockRelease", ReturnType: "void", Description: "Release an active wake lock", Feature: "WakeLock"},

	{Method: "goleo:vibrate", Args: "{ pattern: number[] }", ReturnType: "void", Description: "Trigger vibration with a pattern", Feature: "Vibration"},

	{Method: "goleo:sensorStart", Args: "{ type: string }", ReturnType: "void", Description: "Start a sensor (accelerometer, gyroscope, etc.)", Feature: "Sensors"},
	{Method: "goleo:sensorStop", Args: "{ type: string }", ReturnType: "void", Description: "Stop a sensor", Feature: "Sensors"},

	{Method: "goleo:cameraCapturePhoto", Args: "{ width?: number; height?: number }", ReturnType: "{ data: string; format: string }", Description: "Capture a photo from the camera", Feature: "Camera"},
	{Method: "goleo:cameraStartStream", Args: "{ width?: number; height?: number }", ReturnType: "void", Description: "Start a camera video stream", Feature: "Camera"},
	{Method: "goleo:cameraStopStream", ReturnType: "void", Description: "Stop an active camera stream", Feature: "Camera"},

	{Method: "goleo:bleRequestDevice", Args: "{ filters?: Record<string, unknown> }", ReturnType: "{ id: string; name: string; rssi?: number }", Description: "Request a BLE device", Feature: "Bluetooth"},
	{Method: "goleo:bleConnect", Args: "{ deviceId: string }", ReturnType: "void", Description: "Connect to a BLE device", Feature: "Bluetooth"},
	{Method: "goleo:bleDisconnect", Args: "{ deviceId: string }", ReturnType: "void", Description: "Disconnect from a BLE device", Feature: "Bluetooth"},
	{Method: "goleo:bleRead", Args: "{ deviceId: string; service: string; characteristic: string }", ReturnType: "{ data: string }", Description: "Read data from a BLE characteristic", Feature: "Bluetooth"},
	{Method: "goleo:bleWrite", Args: "{ deviceId: string; service: string; characteristic: string; data: string }", ReturnType: "void", Description: "Write data to a BLE characteristic", Feature: "Bluetooth"},

	{Method: "goleo:nfcStartScan", ReturnType: "void", Description: "Start scanning for NFC tags", Feature: "NFC"},
	{Method: "goleo:nfcStopScan", ReturnType: "void", Description: "Stop scanning for NFC tags", Feature: "NFC"},
	{Method: "goleo:nfcWrite", Args: "{ records: { type: string; mediaType: string; data: string }[] }", ReturnType: "void", Description: "Write data to an NFC tag", Feature: "NFC"},

	{Method: "goleo:backgroundRegisterSync", Args: "{ tag: string }", ReturnType: "void", Description: "Register a background sync event", Feature: "Background"},
	{Method: "goleo:backgroundPermissionGranted", ReturnType: "boolean", Description: "Check if background sync permission is granted", Feature: "Background"},
	{Method: "goleo:backgroundRequestPermission", ReturnType: "void", Description: "Request background sync permission", Feature: "Background"},

	{Method: "goleo:pushSubscribe", Args: "{ serverKey?: string }", ReturnType: "{ endpoint: string; keys: Record<string, string> }", Description: "Subscribe to push notifications", Feature: "Push"},
	{Method: "goleo:pushUnsubscribe", ReturnType: "void", Description: "Unsubscribe from push notifications", Feature: "Push"},
	{Method: "goleo:pushGetSubscription", ReturnType: "{ endpoint: string; keys: Record<string, string> } | null", Description: "Get the current push subscription", Feature: "Push"},
}

KnownCommands is the authoritative list of all built-in bridge commands and their TypeScript types. Used by both the type generator and the scan command to detect feature usage.

View Source
var Version = "dev"

Version is stamped at release time via -ldflags "-X github.com/daforester/goleo/cli/cmd.Version=<v>" (see cli/npm/build-platform-packages.js). It stays "dev" for unstamped builds, where resolveVersion falls back to the module version baked into the binary (e.g. from `go install github.com/daforester/goleo/cli/goleo@v0.1.2`).

Functions

func Execute

func Execute()

Types

type CommandDecl

type CommandDecl struct {
	Method      string
	Args        string // TypeScript type for args, empty if none
	ReturnType  string
	Description string
	Feature     string // name in featureRegistry, empty if core
}

CommandDecl describes a single built-in bridge command with its TypeScript types and optional feature association.

type Feature

type Feature struct {
	Name          string
	BuildTag      string
	Permissions   []string          // Android permissions
	IOSUsageDescs map[string]string // iOS Info.plist keys → descriptions
}

Jump to

Keyboard shortcuts

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