From ba40dae255492b390a7eaa01120e4f8abd0bacda Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Wed, 30 Oct 2024 23:49:21 +0100 Subject: [PATCH] move all autocomplete shell files into Go code strings --- autocomplete/bash_autocomplete | 35 ------------------------ autocomplete/powershell_autocomplete.ps1 | 9 ------ 2 files changed, 44 deletions(-) delete mode 100755 autocomplete/bash_autocomplete delete mode 100644 autocomplete/powershell_autocomplete.ps1 diff --git a/autocomplete/bash_autocomplete b/autocomplete/bash_autocomplete deleted file mode 100755 index 7120a0d222..0000000000 --- a/autocomplete/bash_autocomplete +++ /dev/null @@ -1,35 +0,0 @@ -#! /bin/bash - -: ${PROG:=$(basename ${BASH_SOURCE})} - -# Macs have bash3 for which the bash-completion package doesn't include -# _init_completion. This is a minimal version of that function. -_cli_init_completion() { - COMPREPLY=() - _get_comp_words_by_ref "$@" cur prev words cword -} - -_cli_bash_autocomplete() { - if [[ "${COMP_WORDS[0]}" != "source" ]]; then - local cur opts base words - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - if declare -F _init_completion >/dev/null 2>&1; then - _init_completion -n "=:" || return - else - _cli_init_completion -n "=:" || return - fi - words=("${words[@]:0:$cword}") - if [[ "$cur" == "-"* ]]; then - requestComp="${words[*]} ${cur} --generate-shell-completion" - else - requestComp="${words[*]} --generate-shell-completion" - fi - opts=$(eval "${requestComp}" 2>/dev/null) - COMPREPLY=($(compgen -W "${opts}" -- ${cur})) - return 0 - fi -} - -complete -o bashdefault -o default -o nospace -F _cli_bash_autocomplete $PROG -unset PROG diff --git a/autocomplete/powershell_autocomplete.ps1 b/autocomplete/powershell_autocomplete.ps1 deleted file mode 100644 index cbf76942dd..0000000000 --- a/autocomplete/powershell_autocomplete.ps1 +++ /dev/null @@ -1,9 +0,0 @@ -$fn = $($MyInvocation.MyCommand.Name) -$name = $fn -replace "(.*)\.ps1$", '$1' -Register-ArgumentCompleter -Native -CommandName $name -ScriptBlock { - param($commandName, $wordToComplete, $cursorPosition) - $other = "$wordToComplete --generate-shell-completion" - Invoke-Expression $other | ForEach-Object { - [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) - } - } \ No newline at end of file