first draft completions cmd
This commit is contained in:
parent
cb66ba59f7
commit
dc3f5ab374
|
@ -8,6 +8,7 @@ tasks:
|
||||||
rm openrefine.tar.gz
|
rm openrefine.tar.gz
|
||||||
command: |
|
command: |
|
||||||
sudo ln -s "${PWD}/orcli" /usr/local/bin/
|
sudo ln -s "${PWD}/orcli" /usr/local/bin/
|
||||||
|
eval "$(orcli completions)"
|
||||||
./refine
|
./refine
|
||||||
|
|
||||||
ports:
|
ports:
|
||||||
|
|
|
@ -103,5 +103,5 @@ gem install bashly
|
||||||
3. Generate script
|
3. Generate script
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
bashly generate
|
bashly generate --upgrade
|
||||||
```
|
```
|
||||||
|
|
|
@ -25,6 +25,10 @@ examples:
|
||||||
export tsv "duplicates"
|
export tsv "duplicates"
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
- name: completions
|
||||||
|
help: |-
|
||||||
|
Generate bash completions
|
||||||
|
Usage: eval "\$(orcli completions)"
|
||||||
- name: batch
|
- name: batch
|
||||||
help: start tmp OpenRefine workspace and run multiple orcli commands
|
help: start tmp OpenRefine workspace and run multiple orcli commands
|
||||||
catch_all:
|
catch_all:
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Users can now enable bash completion for this script by running:
|
||||||
|
#
|
||||||
|
# $ eval "$(orcli completions)"
|
||||||
|
#
|
||||||
|
send_completions
|
|
@ -0,0 +1,74 @@
|
||||||
|
## [@bashly-upgrade completions send_completions]
|
||||||
|
send_completions() {
|
||||||
|
echo $'# orcli completion -*- shell-script -*-'
|
||||||
|
echo $''
|
||||||
|
echo $'# This bash completions script was generated by'
|
||||||
|
echo $'# completely (https://github.com/dannyben/completely)'
|
||||||
|
echo $'# Modifying it manually is not recommended'
|
||||||
|
echo $''
|
||||||
|
echo $'_orcli_completions_filter() {'
|
||||||
|
echo $' local words="$1"'
|
||||||
|
echo $' local cur=${COMP_WORDS[COMP_CWORD]}'
|
||||||
|
echo $' local result=()'
|
||||||
|
echo $''
|
||||||
|
echo $' if [[ "${cur:0:1}" == "-" ]]; then'
|
||||||
|
echo $' echo "$words"'
|
||||||
|
echo $' '
|
||||||
|
echo $' else'
|
||||||
|
echo $' for word in $words; do'
|
||||||
|
echo $' [[ "${word:0:1}" != "-" ]] && result+=("$word")'
|
||||||
|
echo $' done'
|
||||||
|
echo $''
|
||||||
|
echo $' echo "${result[*]}"'
|
||||||
|
echo $''
|
||||||
|
echo $' fi'
|
||||||
|
echo $'}'
|
||||||
|
echo $''
|
||||||
|
echo $'_orcli_completions() {'
|
||||||
|
echo $' local cur=${COMP_WORDS[COMP_CWORD]}'
|
||||||
|
echo $' local compwords=("${COMP_WORDS[@]:1:$COMP_CWORD-1}")'
|
||||||
|
echo $' local compline="${compwords[*]}"'
|
||||||
|
echo $''
|
||||||
|
echo $' case "$compline" in'
|
||||||
|
echo $' \'completions\'*)'
|
||||||
|
echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_orcli_completions_filter "--help -h")" -- "$cur" )'
|
||||||
|
echo $' ;;'
|
||||||
|
echo $''
|
||||||
|
echo $' \'import csv\'*)'
|
||||||
|
echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_orcli_completions_filter "--encoding --help --projectName --quiet --separator --trimStrings -h -q")" -- "$cur" )'
|
||||||
|
echo $' ;;'
|
||||||
|
echo $''
|
||||||
|
echo $' \'export tsv\'*)'
|
||||||
|
echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_orcli_completions_filter "--encoding --help --output --quiet -h -q")" -- "$cur" )'
|
||||||
|
echo $' ;;'
|
||||||
|
echo $''
|
||||||
|
echo $' \'import\'*)'
|
||||||
|
echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_orcli_completions_filter "--help -h csv")" -- "$cur" )'
|
||||||
|
echo $' ;;'
|
||||||
|
echo $''
|
||||||
|
echo $' \'export\'*)'
|
||||||
|
echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_orcli_completions_filter "--help -h tsv")" -- "$cur" )'
|
||||||
|
echo $' ;;'
|
||||||
|
echo $''
|
||||||
|
echo $' \'batch\'*)'
|
||||||
|
echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_orcli_completions_filter "--help --memory --port --quiet -h -q")" -- "$cur" )'
|
||||||
|
echo $' ;;'
|
||||||
|
echo $''
|
||||||
|
echo $' \'list\'*)'
|
||||||
|
echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_orcli_completions_filter "--help --quiet -h -q")" -- "$cur" )'
|
||||||
|
echo $' ;;'
|
||||||
|
echo $''
|
||||||
|
echo $' \'info\'*)'
|
||||||
|
echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_orcli_completions_filter "--help --quiet -h -q")" -- "$cur" )'
|
||||||
|
echo $' ;;'
|
||||||
|
echo $''
|
||||||
|
echo $' *)'
|
||||||
|
echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_orcli_completions_filter "--help --version -h -v batch completions export import info list")" -- "$cur" )'
|
||||||
|
echo $' ;;'
|
||||||
|
echo $''
|
||||||
|
echo $' esac'
|
||||||
|
echo $'} &&'
|
||||||
|
echo $'complete -F _orcli_completions orcli'
|
||||||
|
echo $''
|
||||||
|
echo $'# ex: filetype=sh'
|
||||||
|
}
|
Loading…
Reference in New Issue