# shellcheck shell=bash
#########################################################################
#									#
# Author: Copyright (C) 2025  Mark Grant				#
#									#
# Released under the GPLv3 only.					#
# SPDX-License-Identifier: GPL-3.0-only					#
#									#
# Purpose:								#
# Bash completion script.						#
#									#
#########################################################################


_lxcu_copy()
{
	local cur prev OPTS

	COMPREPLY=()
	cur="${COMP_WORDS[COMP_CWORD]}"
	prev="${COMP_WORDS[COMP_CWORD-1]}"
	case $prev in
	-n|--from-name)
		# shellcheck disable=SC2207  # This is _the_ bash completion
		# pattern, so leave it be.
		COMPREPLY=($(compgen -W "$(lxc-ls --stopped)" -- "$cur"))
		return 0
		;;
	esac
	OPTS="-h -n -N -V"
	OPTS+=" --help --from-name --to-name --version"
	# shellcheck disable=SC2207  # This is _the_ bash completion pattern,
	# so leave it be.
	COMPREPLY=( $(compgen -W "${OPTS[*]}" -- "$cur") )
	return 0
}
complete -F _lxcu_copy lxcu-copy

