2017-07-15 04:24:31 +00:00
|
|
|
|
|
|
|
@('gutenberg', './gutenberg') | %{
|
|
|
|
Register-ArgumentCompleter -Native -CommandName $_ -ScriptBlock {
|
|
|
|
param($wordToComplete, $commandAst, $cursorPosition)
|
|
|
|
|
|
|
|
$command = '_gutenberg'
|
|
|
|
$commandAst.CommandElements |
|
|
|
|
Select-Object -Skip 1 |
|
|
|
|
%{
|
|
|
|
switch ($_.ToString()) {
|
|
|
|
|
2017-10-20 08:44:14 +00:00
|
|
|
'gutenberg' {
|
|
|
|
$command += '_gutenberg'
|
2017-07-15 04:24:31 +00:00
|
|
|
break
|
|
|
|
}
|
|
|
|
|
|
|
|
'init' {
|
|
|
|
$command += '_init'
|
|
|
|
break
|
|
|
|
}
|
|
|
|
|
|
|
|
'build' {
|
|
|
|
$command += '_build'
|
|
|
|
break
|
|
|
|
}
|
|
|
|
|
|
|
|
'serve' {
|
|
|
|
$command += '_serve'
|
|
|
|
break
|
|
|
|
}
|
|
|
|
|
|
|
|
'help' {
|
|
|
|
$command += '_help'
|
|
|
|
break
|
|
|
|
}
|
|
|
|
|
|
|
|
default {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$completions = @()
|
|
|
|
|
|
|
|
switch ($command) {
|
|
|
|
|
|
|
|
'_gutenberg' {
|
2017-10-20 08:44:14 +00:00
|
|
|
$completions = @('init', 'build', 'serve', 'help', '-c', '-h', '-V', '--config', '--help', '--version')
|
2017-07-15 04:24:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
'_gutenberg_init' {
|
|
|
|
$completions = @('-h', '-V', '--help', '--version')
|
|
|
|
}
|
|
|
|
|
|
|
|
'_gutenberg_build' {
|
2017-12-29 18:25:06 +00:00
|
|
|
$completions = @('-h', '-V', '-u', '-o', '--help', '--version', '--base-url', '--output-dir')
|
2017-07-15 04:24:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
'_gutenberg_serve' {
|
2017-12-29 18:25:06 +00:00
|
|
|
$completions = @('-h', '-V', '-i', '-p', '-o', '--help', '--version', '--interface', '--port', '--output-dir')
|
2017-07-15 04:24:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
'_gutenberg_help' {
|
|
|
|
$completions = @('-h', '-V', '--help', '--version')
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$completions |
|
|
|
|
?{ $_ -like "$wordToComplete*" } |
|
|
|
|
Sort-Object |
|
|
|
|
%{ New-Object System.Management.Automation.CompletionResult $_, $_, 'ParameterValue', $_ }
|
|
|
|
}
|
|
|
|
}
|