Documentation
¶
Overview ¶
Package sys provides system-level utilities for command execution, environment interaction, and clipboard operations.
Index ¶
- Constants
- Variables
- func BinExists(s string) bool
- func BinPath(s string) string
- func CopyClipboard(s string) error
- func Env(s, def string) string
- func ErrAndExit(err error)
- func ExecCmdWithWriter(ctx context.Context, w io.Writer, s ...string) error
- func ExecuteCmd(ctx context.Context, arg ...string) error
- func OSArgs() []string
- func OpenInBrowser(s string) error
- func ReadClipboard() string
- func RegisterCleanup(fn func())
- func RunCmd(ctx context.Context, s string, arg ...string) error
- func Which(cmd string) (string, error)
- func WithSignalContext(parent context.Context) (context.Context, context.CancelFunc)
Constants ¶
const ( // ExitSuccess indicates normal termination. ExitSuccess = 0 // ExitInterrupted is the conventional exit code for Ctrl+C (SIGINT). ExitInterrupted = 130 // ExitFailure indicates a general failure or unhandled error. ExitFailure = 1 )
Exit codes used by the application.
Variables ¶
Functions ¶
func CopyClipboard ¶
CopyClipboard copies a string to the clipboard.
func Env ¶
Env retrieves an environment variable.
If the environment variable is not set, returns the default value.
func ExecCmdWithWriter ¶ added in v0.1.15
ExecCmdWithWriter runs a command with the given arguments and writes the output to the writer.
func ExecuteCmd ¶
ExecuteCmd runs a command with the given arguments and returns an error if the command fails.
func OpenInBrowser ¶
OpenInBrowser opens a URL in the default browser.
func RegisterCleanup ¶ added in v0.1.30
func RegisterCleanup(fn func())
RegisterCleanup registers a function to be called during program cleanup.
func WithSignalContext ¶ added in v0.1.30
WithSignalContext returns a context that is canceled when an interrupt or termination signal is received.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package browser defines an interface for interacting with web browsers to import bookmarks.
|
Package browser defines an interface for interacting with web browsers to import bookmarks. |
|
blink
Package blink provides functionalities for importing bookmarks from Blink-based web browsers like Chromium, Chrome, and Edge.
|
Package blink provides functionalities for importing bookmarks from Blink-based web browsers like Chromium, Chrome, and Edge. |
|
gecko
Package gecko provides functionalities for importing bookmarks from Gecko-based web browsers like Firefox.
|
Package gecko provides functionalities for importing bookmarks from Gecko-based web browsers like Firefox. |
|
paths
Package browserpath provides functions to generate platform-specific paths for browser profiles and bookmark files.
|
Package browserpath provides functions to generate platform-specific paths for browser profiles and bookmark files. |
|
Package terminal provides utilities for interacting with the command-line terminal.
|
Package terminal provides utilities for interacting with the command-line terminal. |