mirror of
https://github.com/getzola/zola
synced 2024-11-12 23:27:12 +00:00
74 lines
1.9 KiB
PowerShell
74 lines
1.9 KiB
PowerShell
|
|
@('gutenberg', './gutenberg') | %{
|
|
Register-ArgumentCompleter -Native -CommandName $_ -ScriptBlock {
|
|
param($wordToComplete, $commandAst, $cursorPosition)
|
|
|
|
$command = '_gutenberg'
|
|
$commandAst.CommandElements |
|
|
Select-Object -Skip 1 |
|
|
%{
|
|
switch ($_.ToString()) {
|
|
|
|
'Gutenberg' {
|
|
$command += '_Gutenberg'
|
|
break
|
|
}
|
|
|
|
'init' {
|
|
$command += '_init'
|
|
break
|
|
}
|
|
|
|
'build' {
|
|
$command += '_build'
|
|
break
|
|
}
|
|
|
|
'serve' {
|
|
$command += '_serve'
|
|
break
|
|
}
|
|
|
|
'help' {
|
|
$command += '_help'
|
|
break
|
|
}
|
|
|
|
default {
|
|
break
|
|
}
|
|
}
|
|
}
|
|
|
|
$completions = @()
|
|
|
|
switch ($command) {
|
|
|
|
'_gutenberg' {
|
|
$completions = @('init', 'build', 'serve', 'help', '-h', '-V', '-c', '--help', '--version', '--config')
|
|
}
|
|
|
|
'_gutenberg_init' {
|
|
$completions = @('-h', '-V', '--help', '--version')
|
|
}
|
|
|
|
'_gutenberg_build' {
|
|
$completions = @('-h', '-V', '--help', '--version')
|
|
}
|
|
|
|
'_gutenberg_serve' {
|
|
$completions = @('-h', '-V', '--help', '--version')
|
|
}
|
|
|
|
'_gutenberg_help' {
|
|
$completions = @('-h', '-V', '--help', '--version')
|
|
}
|
|
|
|
}
|
|
|
|
$completions |
|
|
?{ $_ -like "$wordToComplete*" } |
|
|
Sort-Object |
|
|
%{ New-Object System.Management.Automation.CompletionResult $_, $_, 'ParameterValue', $_ }
|
|
}
|
|
}
|