#!/usr/bin/env bash # Copyright (c) 2025. LUXIM d.o.o., Slovenia - Matjaž Mozetič. _backtunnel_complete() { local cur cur="${COMP_WORDS[COMP_CWORD]}" if [[ ${COMP_CWORD} -eq 1 ]]; then compopt -o filenames 2>/dev/null mapfile -t COMPREPLY < <(compgen -d -- "${cur}") return 0 fi if [[ ${COMP_CWORD} -eq 2 ]]; then mapfile -t COMPREPLY < <(compgen -W "with from" -- "${cur}") return 0 fi if [[ ${COMP_CWORD} -eq 4 && "${COMP_WORDS[2]}" == "with" ]]; then mapfile -t COMPREPLY < <(compgen -W "for" -- "${cur}") return 0 fi if [[ ${COMP_CWORD} -eq 5 && "${COMP_WORDS[2]}" == "with" && "${COMP_WORDS[4]}" == "for" ]]; then mapfile -t COMPREPLY < <(compgen -W "10m 30m 1h 2h 6h 12h 1d 2d" -- "${cur}") return 0 fi if [[ "${COMP_WORDS[2]}" == "from" ]]; then COMPREPLY=() return 0 fi COMPREPLY=() } complete -F _backtunnel_complete backtunnel-share complete -F _backtunnel_complete backtunnel-access