init
This commit is contained in:
86
completions/bash/csview.bash
generated
Normal file
86
completions/bash/csview.bash
generated
Normal file
@@ -0,0 +1,86 @@
|
||||
_csview() {
|
||||
local i cur prev opts cmd
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
cmd=""
|
||||
opts=""
|
||||
|
||||
for i in ${COMP_WORDS[@]}
|
||||
do
|
||||
case "${cmd},${i}" in
|
||||
",$1")
|
||||
cmd="csview"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
case "${cmd}" in
|
||||
csview)
|
||||
opts="-H -n -t -d -s -p -i -P -h -V --no-headers --number --tsv --delimiter --style --padding --indent --sniff --header-align --body-align --disable-pager --help --version [FILE]"
|
||||
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
||||
return 0
|
||||
fi
|
||||
case "${prev}" in
|
||||
--delimiter)
|
||||
COMPREPLY=($(compgen -f "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-d)
|
||||
COMPREPLY=($(compgen -f "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
--style)
|
||||
COMPREPLY=($(compgen -W "none ascii ascii2 sharp rounded reinforced markdown grid" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-s)
|
||||
COMPREPLY=($(compgen -W "none ascii ascii2 sharp rounded reinforced markdown grid" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
--padding)
|
||||
COMPREPLY=($(compgen -f "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-p)
|
||||
COMPREPLY=($(compgen -f "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
--indent)
|
||||
COMPREPLY=($(compgen -f "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
-i)
|
||||
COMPREPLY=($(compgen -f "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
--sniff)
|
||||
COMPREPLY=($(compgen -f "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
--header-align)
|
||||
COMPREPLY=($(compgen -W "left center right" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
--body-align)
|
||||
COMPREPLY=($(compgen -W "left center right" -- "${cur}"))
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=()
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
if [[ "${BASH_VERSINFO[0]}" -eq 4 && "${BASH_VERSINFO[1]}" -ge 4 || "${BASH_VERSINFO[0]}" -gt 4 ]]; then
|
||||
complete -F _csview -o nosort -o bashdefault -o default csview
|
||||
else
|
||||
complete -F _csview -o bashdefault -o default csview
|
||||
fi
|
||||
47
completions/elvish/csview.elv
generated
Normal file
47
completions/elvish/csview.elv
generated
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
use builtin;
|
||||
use str;
|
||||
|
||||
set edit:completion:arg-completer[csview] = {|@words|
|
||||
fn spaces {|n|
|
||||
builtin:repeat $n ' ' | str:join ''
|
||||
}
|
||||
fn cand {|text desc|
|
||||
edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc
|
||||
}
|
||||
var command = 'csview'
|
||||
for word $words[1..-1] {
|
||||
if (str:has-prefix $word '-') {
|
||||
break
|
||||
}
|
||||
set command = $command';'$word
|
||||
}
|
||||
var completions = [
|
||||
&'csview'= {
|
||||
cand -d 'Specify the field delimiter'
|
||||
cand --delimiter 'Specify the field delimiter'
|
||||
cand -s 'Specify the border style'
|
||||
cand --style 'Specify the border style'
|
||||
cand -p 'Specify padding for table cell'
|
||||
cand --padding 'Specify padding for table cell'
|
||||
cand -i 'Specify global indent for table'
|
||||
cand --indent 'Specify global indent for table'
|
||||
cand --sniff 'Limit column widths sniffing to the specified number of rows. Specify "0" to cancel limit'
|
||||
cand --header-align 'Specify the alignment of the table header'
|
||||
cand --body-align 'Specify the alignment of the table body'
|
||||
cand -H 'Specify that the input has no header row'
|
||||
cand --no-headers 'Specify that the input has no header row'
|
||||
cand -n 'Prepend a column of line numbers to the table'
|
||||
cand --number 'Prepend a column of line numbers to the table'
|
||||
cand -t 'Use ''\t'' as delimiter for tsv'
|
||||
cand --tsv 'Use ''\t'' as delimiter for tsv'
|
||||
cand -P 'Disable pager'
|
||||
cand --disable-pager 'Disable pager'
|
||||
cand -h 'Print help'
|
||||
cand --help 'Print help'
|
||||
cand -V 'Print version'
|
||||
cand --version 'Print version'
|
||||
}
|
||||
]
|
||||
$completions[$command]
|
||||
}
|
||||
13
completions/fish/csview.fish
generated
Normal file
13
completions/fish/csview.fish
generated
Normal file
@@ -0,0 +1,13 @@
|
||||
complete -c csview -s d -l delimiter -d 'Specify the field delimiter' -r
|
||||
complete -c csview -s s -l style -d 'Specify the border style' -r -f -a "{none\t'',ascii\t'',ascii2\t'',sharp\t'',rounded\t'',reinforced\t'',markdown\t'',grid\t''}"
|
||||
complete -c csview -s p -l padding -d 'Specify padding for table cell' -r
|
||||
complete -c csview -s i -l indent -d 'Specify global indent for table' -r
|
||||
complete -c csview -l sniff -d 'Limit column widths sniffing to the specified number of rows. Specify "0" to cancel limit' -r
|
||||
complete -c csview -l header-align -d 'Specify the alignment of the table header' -r -f -a "{left\t'',center\t'',right\t''}"
|
||||
complete -c csview -l body-align -d 'Specify the alignment of the table body' -r -f -a "{left\t'',center\t'',right\t''}"
|
||||
complete -c csview -s H -l no-headers -d 'Specify that the input has no header row'
|
||||
complete -c csview -s n -l number -d 'Prepend a column of line numbers to the table'
|
||||
complete -c csview -s t -l tsv -d 'Use \'\\t\' as delimiter for tsv'
|
||||
complete -c csview -s P -l disable-pager -d 'Disable pager'
|
||||
complete -c csview -s h -l help -d 'Print help'
|
||||
complete -c csview -s V -l version -d 'Print version'
|
||||
53
completions/powershell/_csview.ps1
generated
Normal file
53
completions/powershell/_csview.ps1
generated
Normal file
@@ -0,0 +1,53 @@
|
||||
|
||||
using namespace System.Management.Automation
|
||||
using namespace System.Management.Automation.Language
|
||||
|
||||
Register-ArgumentCompleter -Native -CommandName 'csview' -ScriptBlock {
|
||||
param($wordToComplete, $commandAst, $cursorPosition)
|
||||
|
||||
$commandElements = $commandAst.CommandElements
|
||||
$command = @(
|
||||
'csview'
|
||||
for ($i = 1; $i -lt $commandElements.Count; $i++) {
|
||||
$element = $commandElements[$i]
|
||||
if ($element -isnot [StringConstantExpressionAst] -or
|
||||
$element.StringConstantType -ne [StringConstantType]::BareWord -or
|
||||
$element.Value.StartsWith('-') -or
|
||||
$element.Value -eq $wordToComplete) {
|
||||
break
|
||||
}
|
||||
$element.Value
|
||||
}) -join ';'
|
||||
|
||||
$completions = @(switch ($command) {
|
||||
'csview' {
|
||||
[CompletionResult]::new('-d', 'd', [CompletionResultType]::ParameterName, 'Specify the field delimiter')
|
||||
[CompletionResult]::new('--delimiter', 'delimiter', [CompletionResultType]::ParameterName, 'Specify the field delimiter')
|
||||
[CompletionResult]::new('-s', 's', [CompletionResultType]::ParameterName, 'Specify the border style')
|
||||
[CompletionResult]::new('--style', 'style', [CompletionResultType]::ParameterName, 'Specify the border style')
|
||||
[CompletionResult]::new('-p', 'p', [CompletionResultType]::ParameterName, 'Specify padding for table cell')
|
||||
[CompletionResult]::new('--padding', 'padding', [CompletionResultType]::ParameterName, 'Specify padding for table cell')
|
||||
[CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'Specify global indent for table')
|
||||
[CompletionResult]::new('--indent', 'indent', [CompletionResultType]::ParameterName, 'Specify global indent for table')
|
||||
[CompletionResult]::new('--sniff', 'sniff', [CompletionResultType]::ParameterName, 'Limit column widths sniffing to the specified number of rows. Specify "0" to cancel limit')
|
||||
[CompletionResult]::new('--header-align', 'header-align', [CompletionResultType]::ParameterName, 'Specify the alignment of the table header')
|
||||
[CompletionResult]::new('--body-align', 'body-align', [CompletionResultType]::ParameterName, 'Specify the alignment of the table body')
|
||||
[CompletionResult]::new('-H', 'H ', [CompletionResultType]::ParameterName, 'Specify that the input has no header row')
|
||||
[CompletionResult]::new('--no-headers', 'no-headers', [CompletionResultType]::ParameterName, 'Specify that the input has no header row')
|
||||
[CompletionResult]::new('-n', 'n', [CompletionResultType]::ParameterName, 'Prepend a column of line numbers to the table')
|
||||
[CompletionResult]::new('--number', 'number', [CompletionResultType]::ParameterName, 'Prepend a column of line numbers to the table')
|
||||
[CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'Use ''\t'' as delimiter for tsv')
|
||||
[CompletionResult]::new('--tsv', 'tsv', [CompletionResultType]::ParameterName, 'Use ''\t'' as delimiter for tsv')
|
||||
[CompletionResult]::new('-P', 'P ', [CompletionResultType]::ParameterName, 'Disable pager')
|
||||
[CompletionResult]::new('--disable-pager', 'disable-pager', [CompletionResultType]::ParameterName, 'Disable pager')
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
$completions.Where{ $_.CompletionText -like "$wordToComplete*" } |
|
||||
Sort-Object -Property ListItemText
|
||||
}
|
||||
55
completions/zsh/_csview
generated
Normal file
55
completions/zsh/_csview
generated
Normal file
@@ -0,0 +1,55 @@
|
||||
#compdef csview
|
||||
|
||||
autoload -U is-at-least
|
||||
|
||||
_csview() {
|
||||
typeset -A opt_args
|
||||
typeset -a _arguments_options
|
||||
local ret=1
|
||||
|
||||
if is-at-least 5.2; then
|
||||
_arguments_options=(-s -S -C)
|
||||
else
|
||||
_arguments_options=(-s -C)
|
||||
fi
|
||||
|
||||
local context curcontext="$curcontext" state line
|
||||
_arguments "${_arguments_options[@]}" : \
|
||||
'-d+[Specify the field delimiter]:DELIMITER: ' \
|
||||
'--delimiter=[Specify the field delimiter]:DELIMITER: ' \
|
||||
'-s+[Specify the border style]:STYLE:(none ascii ascii2 sharp rounded reinforced markdown grid)' \
|
||||
'--style=[Specify the border style]:STYLE:(none ascii ascii2 sharp rounded reinforced markdown grid)' \
|
||||
'-p+[Specify padding for table cell]:PADDING: ' \
|
||||
'--padding=[Specify padding for table cell]:PADDING: ' \
|
||||
'-i+[Specify global indent for table]:INDENT: ' \
|
||||
'--indent=[Specify global indent for table]:INDENT: ' \
|
||||
'--sniff=[Limit column widths sniffing to the specified number of rows. Specify "0" to cancel limit]:LIMIT: ' \
|
||||
'--header-align=[Specify the alignment of the table header]:HEADER_ALIGN:(left center right)' \
|
||||
'--body-align=[Specify the alignment of the table body]:BODY_ALIGN:(left center right)' \
|
||||
'-H[Specify that the input has no header row]' \
|
||||
'--no-headers[Specify that the input has no header row]' \
|
||||
'-n[Prepend a column of line numbers to the table]' \
|
||||
'--number[Prepend a column of line numbers to the table]' \
|
||||
'(-d --delimiter)-t[Use '\''\\t'\'' as delimiter for tsv]' \
|
||||
'(-d --delimiter)--tsv[Use '\''\\t'\'' as delimiter for tsv]' \
|
||||
'-P[Disable pager]' \
|
||||
'--disable-pager[Disable pager]' \
|
||||
'-h[Print help]' \
|
||||
'--help[Print help]' \
|
||||
'-V[Print version]' \
|
||||
'--version[Print version]' \
|
||||
'::FILE -- File to view:_files' \
|
||||
&& ret=0
|
||||
}
|
||||
|
||||
(( $+functions[_csview_commands] )) ||
|
||||
_csview_commands() {
|
||||
local commands; commands=()
|
||||
_describe -t commands 'csview commands' commands "$@"
|
||||
}
|
||||
|
||||
if [ "$funcstack[1]" = "_csview" ]; then
|
||||
_csview "$@"
|
||||
else
|
||||
compdef _csview csview
|
||||
fi
|
||||
Reference in New Issue
Block a user