Files
fish-config/functions/bkg.fish
T
rootiest 1341e2559e docs(functions): standardize all function doc blocks to UNIX man-page style
Replace all ad-hoc inline comments between license headers and function
declarations with consistent SYNOPSIS / DESCRIPTION / ARGUMENTS / RETURNS /
EXAMPLE blocks across all 99 project-owned functions/ files. No executable
logic, variable names, or exit codes were modified.

Completes Task #6 from AGENTS.md (Retroactive Function Documentation
Standardization).
2026-06-05 20:18:49 -04:00

33 lines
947 B
Fish

# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
# SYNOPSIS
# bkg <command> [args...]
#
# DESCRIPTION
# Launches a command in the background, fully detached from the terminal
# using nohup. All stdout and stderr output is discarded.
#
# ARGUMENTS
# command The command to run detached
# args... Additional arguments for the command
#
# RETURNS
# 0 Command launched successfully
# 1 No command provided
#
# EXAMPLE
# bkg firefox
function bkg --description 'Execute bkg'
# Check if a command was provided as an argument.
if test -z "$argv[1]"
echo "Usage: bkg <command> [arguments...]"
return 1
end
# Run the command using nohup to make it immune to hangups (like closing the terminal).
# Redirect both stdout and stderr to /dev/null to discard all output.
# The final ampersand (&) sends the entire process to the background.
nohup $argv &>/dev/null &
end