diff --git a/functions/branch.fish b/functions/branch.fish index 287b12a..0380f29 100644 --- a/functions/branch.fish +++ b/functions/branch.fish @@ -1,4 +1,25 @@ -# Switch to or create a git branch +# Copyright (C) 2026 Rootiest +# SPDX-License-Identifier: AGPL-3.0-or-later + +# CATEGORY +# 04-git-and-version-control +# +# SYNOPSIS +# branch +# +# DESCRIPTION +# Switches to a local git branch, creating it if it does not already +# exist. Extra arguments are forwarded to git checkout. +# +# ARGUMENTS +# branch_name Branch to switch to or create +# +# RETURNS +# 0 Branch checked out or created +# 1 Not inside a git work tree +# +# EXAMPLE +# branch feature/new-ui function branch --description 'Switch to or create a git branch' if not git rev-parse --is-inside-work-tree >/dev/null 2>&1 echo "Not a git repo." diff --git a/functions/fc.fish b/functions/fc.fish index 2d4e2dd..72490bb 100644 --- a/functions/fc.fish +++ b/functions/fc.fish @@ -1,4 +1,28 @@ -# Edit and execute the last command (Bash-style fc) +# Copyright (C) 2026 Rootiest +# SPDX-License-Identifier: AGPL-3.0-or-later + +# CATEGORY +# 03-editors-and-viewers +# +# SYNOPSIS +# fc [command_prefix] +# +# DESCRIPTION +# Edits the last shell command -- or the most recent one matching a +# prefix -- in $EDITOR, then executes the result. Bash-style fc +# behaviour. Falls back to vi when $EDITOR is unset, and aborts without +# executing if the buffer is left empty. +# +# ARGUMENTS +# command_prefix Search history for the newest command matching this +# +# RETURNS +# The edited command's exit status, or a message when history lookup +# found nothing. +# +# EXAMPLE +# fc +# fc git function fc --description 'Edit and execute the last command (Bash-style fc)' set -l tmpfile (mktemp /tmp/fish_fc.XXXXXX).fish diff --git a/functions/gitup.fish b/functions/gitup.fish index 97ea590..5bff81f 100644 --- a/functions/gitup.fish +++ b/functions/gitup.fish @@ -1,4 +1,26 @@ -# Fetch updates and show git status +# Copyright (C) 2026 Rootiest +# SPDX-License-Identifier: AGPL-3.0-or-later + +# CATEGORY +# 04-git-and-version-control +# +# SYNOPSIS +# gitup [args...] +# +# DESCRIPTION +# Fetches updates from the remote and shows git status. Extra arguments +# are forwarded to git fetch. +# +# ARGUMENTS +# args... Forwarded verbatim to git fetch +# +# RETURNS +# 0 Fetch and status succeeded +# 1 Not inside a git work tree +# +# EXAMPLE +# gitup +# gitup --all function gitup --description 'Fetch updates and show git status' # Check if we are even in a git repository if not git rev-parse --is-inside-work-tree >/dev/null 2>&1 diff --git a/functions/sudo-toggle.fish b/functions/sudo-toggle.fish index 8d90e7c..af52653 100644 --- a/functions/sudo-toggle.fish +++ b/functions/sudo-toggle.fish @@ -1,3 +1,23 @@ +# Copyright (C) 2026 Rootiest +# SPDX-License-Identifier: AGPL-3.0-or-later + +# CATEGORY +# 07-system-and-monitoring +# +# SYNOPSIS +# sudo-toggle +# +# DESCRIPTION +# Toggles the sudo NOPASSWD rule on and off via +# /etc/sudoers.d/nofail-toggle. Useful for automated tasks that would +# otherwise require a password entry. Clears the sudo credential cache +# when re-enabling, so the lockdown takes effect immediately. +# +# RETURNS +# 0 Rule toggled +# +# EXAMPLE +# sudo-toggle function sudo-toggle --description 'Toggle sudo password requirement on/off' # Check the file size using sudo stat to see if our bypass rule is active set -l file_size (sudo stat -c %s /etc/sudoers.d/nofail-toggle 2>/dev/null)