UNPKG

@shutootaki/gwm

Version:
42 lines (38 loc) 1.19 kB
/** * bash 補完スクリプト生成 */ /** * bash 補完スクリプトを生成 * @param _definition 補完定義(将来の定義駆動生成に備えて予約) * @returns bash 補完スクリプト文字列 */ export function generateBashScript(_definition) { return `#!/bin/bash # gwm bash completion script # Generated by gwm completion # # Installation: # gwm completion install --shell bash # # Manual installation: # Copy this file to ~/.local/share/bash-completion/completions/gwm # Or add the following to your ~/.bashrc: # eval "$(gwm completion script --shell bash)" _gwm_complete() { local cur="\${COMP_WORDS[COMP_CWORD]}" local words=("\${COMP_WORDS[@]:1}") local cword=$((COMP_CWORD - 1)) # gwm completion __complete を呼び出し local candidates candidates=$(gwm completion __complete --shell bash --cword "$cword" -- "\${words[@]}" 2>/dev/null) if [[ -n "$candidates" ]]; then # タブ区切りの説明を除去してcompgenに渡す local values values=$(echo "$candidates" | cut -f1) COMPREPLY=($(compgen -W "$values" -- "$cur")) fi } complete -F _gwm_complete gwm `; } //# sourceMappingURL=bash.js.map