franta-hg@112: # Alt2XML franta-hg@112: # Copyright © 2020 František Kučera (Frantovo.cz, GlobalCode.info) franta-hg@112: # franta-hg@112: # This program is free software: you can redistribute it and/or modify franta-hg@112: # it under the terms of the GNU General Public License as published by franta-hg@112: # the Free Software Foundation, version 3 of the License. franta-hg@112: # franta-hg@112: # This program is distributed in the hope that it will be useful, franta-hg@112: # but WITHOUT ANY WARRANTY; without even the implied warranty of franta-hg@112: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the franta-hg@112: # GNU General Public License for more details. franta-hg@112: # franta-hg@112: # You should have received a copy of the GNU General Public License franta-hg@112: # along with this program. If not, see . franta-hg@112: franta-hg@112: _alt2xml_completion() { franta-hg@112: local w0 w1 w2 w3 franta-hg@112: franta-hg@112: COMPREPLY=() franta-hg@112: w0=${COMP_WORDS[COMP_CWORD]} franta-hg@112: w1=${COMP_WORDS[COMP_CWORD-1]} franta-hg@112: w2=${COMP_WORDS[COMP_CWORD-2]} franta-hg@112: w3=${COMP_WORDS[COMP_CWORD-3]} franta-hg@112: franta-hg@112: BOOLEAN=( franta-hg@112: "true" franta-hg@112: "false" franta-hg@112: ) franta-hg@112: franta-hg@112: ACTION=( franta-hg@112: "xml" franta-hg@112: "xpath" franta-hg@112: "xslt" franta-hg@112: ) franta-hg@112: franta-hg@112: franta-hg@112: if [[ "$w1" == "--input-file" ]]; then compopt -o default; COMPREPLY=() franta-hg@112: elif [[ "$w1" == "--system-id" && "x$w0" == "x" ]]; then COMPREPLY=("''") franta-hg@112: elif [[ "$w1" == "--input-url" && "x$w0" == "x" ]]; then COMPREPLY=("''") franta-hg@112: elif [[ "$w1" == "--reader-property" && "x$w0" == "x" ]]; then COMPREPLY=("''") franta-hg@112: elif [[ "$w2" == "--reader-property" && "x$w0" == "x" ]]; then COMPREPLY=("''") franta-hg@112: elif [[ "$w1" == "--reader-feature" && "x$w0" == "x" ]]; then COMPREPLY=("''") franta-hg@112: elif [[ "$w2" == "--reader-feature" && "x$w0" == "x" ]]; then COMPREPLY=("''") franta-hg@112: elif [[ "$w1" == "--reader-namespace-aware" ]]; then COMPREPLY=($(compgen -W "${BOOLEAN[*]}" -- "$w0")) franta-hg@112: elif [[ "$w1" == "--action" ]]; then COMPREPLY=($(compgen -W "${ACTION[*]}" -- "$w0")) franta-hg@112: elif [[ "$w1" == "--action-property" && "x$w0" == "x" ]]; then COMPREPLY=("''") franta-hg@112: elif [[ "$w2" == "--action-property" && "x$w0" == "x" ]]; then COMPREPLY=("''") franta-hg@112: elif [[ "$w1" == "--" && "x$w0" == "x" ]]; then COMPREPLY=("''") franta-hg@112: else franta-hg@112: OPTIONS=( franta-hg@112: "--input-file" franta-hg@112: "--input-stdin" franta-hg@112: "--system-id" franta-hg@112: "--input-url" franta-hg@112: "--reader-property" franta-hg@112: "--reader-feature" franta-hg@112: "--reader-namespace-aware" franta-hg@112: "--action" franta-hg@112: "--action-property" franta-hg@112: "--" franta-hg@112: ) franta-hg@112: COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0")) franta-hg@112: fi franta-hg@112: } franta-hg@112: franta-hg@112: complete -F _alt2xml_completion alt2xml