mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Switch grafana server command to use urfave/cli/v2 (#60684)
* switch grafana server to use urfave/cli/v2 * autocomplete support * lint fix
This commit is contained in:
18
packaging/autocomplete/bash_autocomplete
Normal file
18
packaging/autocomplete/bash_autocomplete
Normal file
@@ -0,0 +1,18 @@
|
||||
#! /bin/bash
|
||||
|
||||
_cli_bash_autocomplete() {
|
||||
if [[ "${COMP_WORDS[0]}" != "source" ]]; then
|
||||
local cur opts base
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
if [[ "$cur" == "-"* ]]; then
|
||||
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} ${cur} --generate-bash-completion )
|
||||
else
|
||||
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion )
|
||||
fi
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
complete -o bashdefault -o default -o nospace -F _cli_bash_autocomplete grafana
|
||||
8
packaging/autocomplete/powershell_autocomplete.ps1
Normal file
8
packaging/autocomplete/powershell_autocomplete.ps1
Normal file
@@ -0,0 +1,8 @@
|
||||
$name = "grafana"
|
||||
Register-ArgumentCompleter -Native -CommandName $name -ScriptBlock {
|
||||
param($commandName, $wordToComplete, $cursorPosition)
|
||||
$other = "$wordToComplete --generate-bash-completion"
|
||||
Invoke-Expression $other | ForEach-Object {
|
||||
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
|
||||
}
|
||||
}
|
||||
20
packaging/autocomplete/zsh_autocomplete
Normal file
20
packaging/autocomplete/zsh_autocomplete
Normal file
@@ -0,0 +1,20 @@
|
||||
#compdef grafana
|
||||
|
||||
_cli_zsh_autocomplete() {
|
||||
local -a opts
|
||||
local cur
|
||||
cur=${words[-1]}
|
||||
if [[ "$cur" == "-"* ]]; then
|
||||
opts=("${(@f)$(${words[@]:0:#words[@]-1} ${cur} --generate-bash-completion)}")
|
||||
else
|
||||
opts=("${(@f)$(${words[@]:0:#words[@]-1} --generate-bash-completion)}")
|
||||
fi
|
||||
|
||||
if [[ "${opts[1]}" != "" ]]; then
|
||||
_describe 'values' opts
|
||||
else
|
||||
_files
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _cli_zsh_autocomplete grafana
|
||||
Reference in New Issue
Block a user