Mark private functions that don't need localization

See the next commit.

Part of #11833

(cherry picked from commit a53db72564)
This commit is contained in:
Johannes Altmanninger
2025-09-29 09:30:35 +02:00
parent 1f96e58852
commit 2c0e912fe1
136 changed files with 156 additions and 6 deletions

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
# returns 0 only if any argument is on of the supplied arguments
function __fish_any_arg_in
set -l haystack $argv

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_anypager --description "Print a pager to use"
set -l pager
# We prefer $PAGER if we have it

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_anypython
# Try python3 first, because that's usually faster and generally nicer.
# Do not consider the stub /usr/bin/python3 that comes installed on Darwin to be Python

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_append -d "Internal completion function for appending string to the commandline" --argument-names sep
set -e argv[1]
set -l str (commandline -tc | string replace -rf "(.*$sep)[^$sep]*" '$1' | string replace -r -- '--.*=' '')

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
if not type -q apropos
function __fish_apropos
end

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_argcomplete_complete
set -lx _ARGCOMPLETE 1
set -lx _ARGCOMPLETE_IFS \n

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_cache_put
set -l cache_file $argv[1]
touch $cache_file

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_cache_sourced_completions
# Allow a `--name=foo` option which ends up in the filename.
argparse -s name= -- $argv

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_cached --description "Cache the command output for a given amount of time"
argparse --min-args 1 --max-args 1 --stop-nonopt 't/max-age=!_validate_int --min 0' 'k/cache-key=' -- $argv

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
# This is meant to be bound to something like ctrl-c
function __fish_cancel_commandline
commandline -f cancel-commandline

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_change_key_bindings --argument-names bindings
set -g __fish_active_key_bindings $bindings
# Allow the user to set the variable universally

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
# TODO: This function is deprecated. It was used in fish_clipboard_paste
# which some users copied, so maybe leave it around for a few years.
function __fish_commandline_is_singlequoted --description "Return 0 if the current token has an open single-quote"

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_atool_archive_contents --description 'List archive contents'
set -l cmd (commandline -cxp)
set -e cmd[1]

View File

@@ -1,3 +1,5 @@
# localization: skip(private)
#
# Helper function for completions that need to enumerate block devices.
function __fish_complete_blockdevice
set -l cmd (commandline -ct)

View File

@@ -1,3 +1,5 @@
# localization: skip(private)
#
# This function only emits completions that might result from matches against $CDPATH. We rely on
# the core file name completion logic to include all other possible matches.
function __fish_complete_cd -d "Completions for the cd command"

View File

@@ -1,3 +1,5 @@
# localization: skip(private)
#
# This function is compatible with clang, clang++, and variations thereof, and is shared
# by clang.fish and clang++.fish.
# We dynamically query the head at `(commandline -x)[1]` to get the correct completions.

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_command --description 'Complete using all available commands'
set -l ctoken "$(commandline -ct)"
switch $ctoken

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_convert_options --description 'Complete Convert options' --argument-names what
switch $what
case format Format

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
#
# Find directories that complete $argv[1], output them as completions
# with description $argv[2] if defined, otherwise use 'Directory'.

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_freedesktop_icons -d 'List installed icon names according to `https://specifications.freedesktop.org/icon-theme-spec/0.13/`'
# The latest `icon-theme-spec` as of 2024-08-10 is 0.13
# https://specifications.freedesktop.org/icon-theme-spec/latest/

View File

@@ -1,5 +1,6 @@
# Helper function for contextual autocompletion of GPG key ids
# localization: skip(private)
# Helper function for contextual autocompletion of GPG key ids
function __fish_complete_gpg_key_id -d 'Complete using gpg key ids' -a __fish_complete_gpg_command list_arg
# Use user id as description
set -l keyid

View File

@@ -1,5 +1,6 @@
# Helper function for contextual autocompletion of gpg user ids
# localization: skip(private)
# Helper function for contextual autocompletion of gpg user ids
function __fish_complete_gpg_user_id -d "Complete using gpg user ids" -a __fish_complete_gpg_command list_arg
# gpg doesn't seem to like it when you use the whole key name as a
# completion, so we skip the <EMAIL> part and use it as a description.

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_group_ids --description "Complete group IDs with group name as description"
if command -sq getent
getent group | string replace -f -r '^([[:alpha:]_][^:]*):[^:]*:(\d+).*' '$2\t$1'

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_groups --description "Print a list of local groups, with group members as the description"
if command -sq getent
getent group | while read -l line

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_job_pids --description "Print a list of job PIDs and their commands"
if set -l jobpids (jobs -p)
# when run at the commandline, the first line of output is a header, but

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_list --argument-names div cmd prefix iprefix
if not set -q cmd[1]
echo "Usage:

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_lpr_option --description 'Complete lpr option'
set -l optstr "$(commandline -t)"
switch $optstr

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_man
# Try to guess what section to search in. If we don't know, we
# use [^)]*, which should match any section.

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_path --description "Complete using path"
set -l target
set -l description

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_pg_database
psql -AtqwlXF \t 2>/dev/null | awk 'NF > 1 { print $1 }'
end

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_pg_user
psql -AtqwXc 'select usename from pg_user' template1 2>/dev/null
end

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_pids -d "Print a list of process identifiers along with brief descriptions"
# This may be a bit slower, but it's nice - having the tty displayed is really handy
# 'tail -n +2' deletes the first line, which contains the headers

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_ppp_peer --description 'Complete isp name for pon/poff'
find /etc/ppp/peers/ -type f -printf '%f\n'

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_proc
# "comm=" means "print comm field with an empty name", which causes the header to be removed.
# On many systems, comm is truncated (e.g. on Linux it's 15 chars),

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_subcommand -d "Complete subcommand" --no-scope-shadowing
# How many non-option tokens we skip in the input commandline before completing the subcommand
# Usually 1; use "--fcs-skip=2" to make it 2 (see e.g. tmux and ssh completions)

View File

@@ -1,3 +1,5 @@
# localization: skip(private)
#
# Find files ending in any of the non-switch arguments and output them as completions.
# * --description provides the description that should be part of each generated completion,
# * --prefix=DIR makes __fish_complete_suffix behave as if it were called in DIR rather than $PWD

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_user_at_hosts -d "Print list host-names with user@"
for user_at in (commandline -ct | string match -r '.*@'; or echo "")(__fish_print_hostnames)
echo $user_at

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_user_ids --description "Complete user IDs with user name as description"
if command -sq getent
getent passwd | string replace -f -r '^([[:alpha:]_][^:]*):[^:]*:(\d+).*' '$2\t$1'

View File

@@ -1,3 +1,5 @@
# localization: skip(private)
#
# This should be used where you want user names with a description. Such as in an argument
# completion. If you just want a list of user names use __fish_print_users.
# The string replace command takes into account GECOS-formatted description fields, by retaining

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_complete_zfs_pools -d "Completes with available ZFS pools"
zpool list -o name,comment -H | string replace -a \t'-' ''
end

View File

@@ -1,3 +1,5 @@
# localization: skip(private)
#
# This function is intended to be used to generate completions in `-a "(...)"` calls for arguments that take 1..n values
# separated by commas and we dynamically or statically generated a list of n values that must be combined and permuted
# in order to appease both the `complete` machinery and the target application.

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
#
# Initializations that should only be performed when entering interactive mode.
#

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_contains_opt -d "Checks if a specific option has been given in the current commandline"
set -l next_short
set -l short_opt

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
# a function to obtain a list of installed packages with CRUX pkgutils
function __fish_crux_packages -d 'Obtain a list of installed packages'
pkginfo -i | string split -f1 ' '

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_cursor_konsole -d 'Set cursor (konsole)'
set -l shape $argv[1]
switch "$shape"

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_cursor_xterm -d 'Set cursor (xterm)'
set -l shape $argv[1]

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
#
# This function is used internally by the fish command completion code
#

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
set -l erase_line "$(
if status test-feature ignore-terminfo
echo \e\[K

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
# Retrieves the first non-switch argument from the command line buffer
function __fish_first_token
set -l tokens (commandline -cx)

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_gnu_complete -d "Wrapper for the complete built-in. Skips the long completions on non-GNU systems"
set -l is_gnu 0

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
set -l dir "$(path dirname -- (status fish-path 2>/dev/null))"
if command -v $dir/fish_indent >/dev/null

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
# determine if this is the very first argument (regardless if switch or not)
function __fish_is_first_arg
set -l tokens (commandline -pxc)

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_is_first_token -d 'Test if no non-switch argument has been specified yet'
__fish_is_nth_token 1
end

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_is_git_repository --description 'Check if the current directory is a git repository'
git rev-parse --is-inside-work-tree 2>/dev/null >/dev/null
end

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_is_nth_token --description 'Test if current token is the Nth (ignoring command and switches/flags)' --argument-names n
set -l tokens (commandline -pxc)
set -l tokens (string replace -r --filter '^([^-].*)' '$1' -- $tokens)

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
# Whether or not the current token is a switch
function __fish_is_switch
string match -qr -- '^-' ""(commandline -ct)

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_is_token_n --description 'Test if current token is on Nth place' --argument-names n
__fish_is_nth_token $n
end

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_is_zfs_feature_enabled \
-a feature pool \
-d "Returns 0 if the given ZFS pool feature is active or enabled for the given pool or for any pool if none specified"

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_make_cache_dir --description "Create and return XDG_CACHE_HOME"
set -l xdg_cache_home $XDG_CACHE_HOME
if test -z "$xdg_cache_home"; or string match -qv '/*' -- $xdg_cache_home; or set -q xdg_cache_home[2]

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_make_completion_signals --description 'Make list of kill signals for completion'
set -q __kill_signals
and return 0

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_man_page
# Get all commandline tokens not starting with "-", up to and including the cursor's
set -l args (string match -rv '^-|^$' -- (commandline -cpx && commandline -t))

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_md5
if type -q md5sum
# GNU systems
@@ -5,7 +6,7 @@ function __fish_md5
if test $argv[1] = -s
echo $argv[2] | md5sum | string split ' ' -f 1
else
printf (_ "%s: Too many arguments %s\n") fish_md5 $argv >&2
printf "%s: Too many arguments %s\n" fish_md5 $argv >&2
end
else
md5sum $argv[1] | string split ' ' -f 1
@@ -17,7 +18,7 @@ function __fish_md5
if test $argv[1] = -s
md5 -s $argv[2]
else
printf (_ "%s: Too many arguments %s\n") fish_md5 $argv >&2
printf "%s: Too many arguments %s\n" fish_md5 $argv >&2
end
else
md5 -q $argv[1]

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_mktemp_relative
# OSX mktemp is rather restricted - no suffix, no way to automatically use TMPDIR
if not set -q TMPDIR[1]

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_move_last -d "Move the last element of a directory history from src to dest"
set -l src $argv[1]
set -l dest $argv[2]

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_no_arguments -d "Internal fish function"
set -l cmd (commandline -pxc) (commandline -tc)
set -e cmd[1]

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_not_contain_opt -d "Checks that a specific option is not in the current command line"
set -l next_short
set -l short_opt

View File

@@ -1,3 +1,5 @@
# localization: skip(private)
#
# This file is explicitly sourced by the npm and yarn completions
# It is used to enumerate entries from the npm registry, interact with a locally installed
# package.json file, and more.

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_nth_token --description 'Prints the Nth token (ignoring command and switches/flags)' --argument-names n
set -l tokens (commandline -px | string replace -r --filter '^([^-].*)' '$1')
# Increment $n by one to account for ignoring the command

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_number_of_cmd_args_wo_opts
count (__fish_print_cmd_args_without_options)
end

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_paginate -d "Paginate the current command using the users default pager"
set -l cmd (__fish_anypager)
or return 1

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
# Generates a list of parent directories for a given path
# i.e. /a/b/c/d -> [/a/b/c/, /a/b/, /a/, and /a]
function __fish_parent_directories

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_paste
# Also split on \r, otherwise it looks confusing
set -l data (string split \r -- $argv[1] | string split \n)

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_prepend_sudo -d " DEPRECATED: use fish_commandline_prepend instead. Prepend 'sudo ' to the beginning of the current commandline"
fish_commandline_prepend sudo
end

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
# returns 0 only if previous argument is one of the supplied arguments
function __fish_prev_arg_in
set -l tokens (commandline -cx)

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_preview_current_file --description "Open the file at the cursor in a pager"
if __fish_edit_command_if_at_cursor
return 0

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_VBox_vms
set -l print_names true
set -l print_uuids true

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_addresses --description "List own network addresses with interface as description"
# if --all is given, also print 0.0.0.0 and ::
if contains -- --all $argv

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_apt_packages
argparse --name=__fish_print_packages i/installed -- $argv
or return

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_cmd_args
commandline -pxc
end

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_cmd_args_without_options
__fish_print_cmd_args | string match -re '^[^-]'
end

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_commands --description "Print a list of documented fish commands"
if set -q __fish_data_dir[1] && test -d $__fish_data_dir/man/man1/
for file in $__fish_data_dir/man/man1/**.1*

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_debian_apache_confs
# Helper script for completions for a2enconf/a2disconf
for conf in /etc/apache2/conf-available/*.conf

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_debian_apache_mods
# Helper script for completions for a2enmod/a2dismod
for mod in /etc/apache2/mods-available/*.load

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_debian_apache_sites
# Helper script for completions for a2ensite/a2dissite
for site in /etc/apache2/sites-available/*

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_encodings -d "Complete using available character encodings"
if iconv --usage &>/dev/null # only GNU has this flag
# Note: GNU iconv changes its output to contain the forward slashes below when stdout is not a tty.

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_eopkg_packages
type -q -f eopkg || return 1

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_filesystems -d "Print a list of all known filesystem types"
set -l fs adfs affs autofs btrfs coda coherent cramfs devpts efs ext ext2 ext3 ffs
set -a fs hfs hpfs iso9660 jfs minix msdos ncpfs nfs ntfs proc qnx4 ramfs

View File

@@ -1,3 +1,5 @@
# localization: skip(private)
#
# Helper function for contextual autocompletion of GPG crypto algorithm options
function __fish_print_gpg_algo -d "Complete using all algorithms of the type specified in argv[2] supported by gpg. argv[2] is a regexp" -a __fish_complete_gpg_command

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
# This should be used where you want group names without a description. If you also want
# a description, such as when getting a list of groups for a completion, you probably want
# __fish_complete_groups.

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_help --description "Print help for the specified fish function or builtin"
set -l item $argv[1]
switch $item
@@ -73,7 +74,7 @@ function __fish_print_help_pre_4.1 --description "Print help message for the spe
set -a format -rLL={$cols}n
end
else
echo fish: (_ "Cannot format help; no parser found") >&2
echo "fish: Cannot format help; no parser found" >&2
return 1
end

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_hostnames -d "Print a list of known hostnames"
# This function used to primarily query `getent hosts` and only read from `/etc/hosts` if
# `getent` did not exist or `getent hosts` failed, based off the (documented) assumption that

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_interfaces --description "Print a list of known network interfaces"
if test -d /sys/class/net
path basename /sys/class/net/*

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_lpr_options --description 'Print lpr options'
lpoptions -l 2>/dev/null | sed 's+\(.*\)/\(.*\):.*$+\1\t\2+'

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_lpr_printers --description 'Print lpr printers'
lpstat -p 2>/dev/null | sed 's/^\S*\s\(\S*\)\s\(.*\)$/\1\t\2/'

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
# Helper function for completions that need to enumerate Linux modules
function __fish_print_modules
find /lib/modules/(uname -r)/{kernel,misc} -type f 2>/dev/null | sed -e 's$/.*/\([^/.]*\).*$\1$'

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_mounted --description 'Print mounted devices'
if test -r /etc/mtab
# In mtab, spaces are replaced by a literal '\040'

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_opkg_packages
type -q -f opkg || return 1

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_packages
# This is `__fish_print_packages`. It prints packages,
# from the first package manager it finds.

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_pacman_packages
# Caches for 5 minutes
type -q -f pacman || return 1

View File

@@ -1,3 +1,4 @@
# localization: skip(private)
function __fish_print_pacman_repos --description "Print the repositories configured for arch's pacman package manager"
string match -er "\[.*\]" </etc/pacman.conf | string match -r -v "^#|options" | string replace -ra "\[|\]" ""
end

Some files were not shown because too many files have changed in this diff Show More