HEX
Server: Apache/2.4.65 (Debian)
System: Linux srv39710 6.1.0-41-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.158-1 (2025-11-09) x86_64
User: root (0)
PHP: 8.4.11
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Upload Files
File: //usr/share/bash-completion/completions/wg-quick
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2015-2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.

_wg_quick_completion() {
	local p i a search_paths old_glob
	search_paths=( /etc/wireguard )

	old_glob="$(shopt -p nullglob)"
	shopt -s nullglob

	[[ $OSTYPE == *freebsd* || $OSTYPE == *darwin* ]] && search_paths+=( /usr/local/etc/wireguard )

	if [[ $COMP_CWORD -eq 1 ]]; then
		COMPREPLY+=( $(compgen -W "up down" -- "${COMP_WORDS[1]}") )
	elif [[ $COMP_CWORD -eq 2 ]]; then
		if [[ ${COMP_WORDS[1]} == up ]]; then
			for p in "${search_paths[@]}"; do
				for i in "$p"/*.conf; do
					i="${i##*/}"; i="${i%.conf}"
					mapfile -t a < <(compgen -W "$i" -- "${COMP_WORDS[2]}")
					COMPREPLY+=( "${a[@]}" )
				done
			done
			mapfile -t a < <(compgen -f -X '!*.conf' -- "${COMP_WORDS[2]}")
			COMPREPLY+=( "${a[@]}" )
			mapfile -t a < <(compgen -d -- "${COMP_WORDS[2]}")
			COMPREPLY+=( "${a[@]}" )
		elif [[ ${COMP_WORDS[1]} == down ]]; then
			if [[ $OSTYPE == *openbsd* || $OSTYPE == *darwin* ]]; then
				for i in /var/run/wireguard/*.name; do
					i="${i##*/}"; i="${i%.name}"
					mapfile -t a < <(compgen -W "$i" -- "${COMP_WORDS[2]}")
					COMPREPLY+=( "${a[@]}" )
				done
			else
				COMPREPLY+=( $(compgen -W "$(wg show interfaces)" -- "${COMP_WORDS[2]}") )
			fi
		fi
	fi
	eval "$old_glob"
}

complete -o filenames -o nosort -F _wg_quick_completion wg-quick