diff --git a/completions/git/hooks.ps1 b/completions/git/hooks.ps1 index ce385f1..b432741 100644 --- a/completions/git/hooks.ps1 +++ b/completions/git/hooks.ps1 @@ -1,6 +1,6 @@ function handleCompletions([System.Collections.Generic.List[System.Object]]$completions) { $tempList = [System.Collections.Generic.List[System.Object]]@() - function addCompletion($name, $symbol = '', $tip = ' ') { + function addCompletion($name, $tip = ' ', $symbol = '') { $tempList.Add(@{ name = $name symbol = $symbol @@ -42,33 +42,33 @@ function handleCompletions([System.Collections.Generic.List[System.Object]]$comp foreach ($_ in $branch_list) { $info = 'branch --- ' + $_ - addCompletion "switch $($_)" '' $info - addCompletion "merge $($_)" '' $info - addCompletion "diff $($_)" '' $info + addCompletion "switch $($_)" $info + addCompletion "merge $($_)" $info + addCompletion "diff $($_)" $info } foreach ($_ in $head_list.Keys) { $info = $head_list.$_ - addCompletion "rebase -i $($_)" '' $info - addCompletion "rebase --interactive $($_)" '' $info - addCompletion "diff $($_)" '' $info - addCompletion "reset $($_)" '' $info - addCompletion "reset --soft $($_)" '' $info - addCompletion "reset --hard $($_)" '' $info - addCompletion "reset --mixed $($_)" '' $info - addCompletion "show $($_)" '' $info + addCompletion "rebase -i $($_)" $info + addCompletion "rebase --interactive $($_)" $info + addCompletion "diff $($_)" $info + addCompletion "reset $($_)" $info + addCompletion "reset --soft $($_)" $info + addCompletion "reset --hard $($_)" $info + addCompletion "reset --mixed $($_)" $info + addCompletion "show $($_)" $info } foreach ($_ in $branch_head_list) { $info = if ($head_list.$_) { $head_list.$_ }else { 'branch --- ' + $_ } - addCompletion "checkout $($_)" '' $info + addCompletion "checkout $($_)" $info } foreach ($_ in $remote_list) { $info = 'remote --- ' + $_ - addCompletion "push $($_)" '' $info + addCompletion "push $($_)" $info - addCompletion "pull $($_)" '' $info - addCompletion "fetch $($_)" '' $info - addCompletion "remote rename $($_)" '' $info - addCompletion "remote rm $($_)" '' $info + addCompletion "pull $($_)" $info + addCompletion "fetch $($_)" $info + addCompletion "remote rename $($_)" $info + addCompletion "remote rm $($_)" $info } foreach ($_ in $commit_info) { $hash = $_[0] @@ -77,30 +77,30 @@ function handleCompletions([System.Collections.Generic.List[System.Object]]$comp $commit = $_[3..($_.Length - 1)] $content = $date + "`n" + $author + "`n" + ($commit -join "`n") - addCompletion "commit -C $($hash)" '' $content - addCompletion "rebase -i $($hash)" '' $content - addCompletion "rebase --interactive $($hash)" '' $content - addCompletion "checkout $($hash)" '' $content - addCompletion "diff $($hash)" '' $content - addCompletion "reset $($hash)" '' $content - addCompletion "reset --soft $($hash)" '' $content - addCompletion "reset --hard $($hash)" '' $content - addCompletion "reset --mixed $($hash)" '' $content - addCompletion "show $($hash)" '' $content - addCompletion "revert $($hash)" '' $content - addCompletion "commit $($hash)" '' $content + addCompletion "commit -C $($hash)" $content + addCompletion "rebase -i $($hash)" $content + addCompletion "rebase --interactive $($hash)" $content + addCompletion "checkout $($hash)" $content + addCompletion "diff $($hash)" $content + addCompletion "reset $($hash)" $content + addCompletion "reset --soft $($hash)" $content + addCompletion "reset --hard $($hash)" $content + addCompletion "reset --mixed $($hash)" $content + addCompletion "show $($hash)" $content + addCompletion "revert $($hash)" $content + addCompletion "commit $($hash)" $content } foreach ($_ in $tag_list) { - addCompletion "tag -d $($_)" '' "tag --- $($_)" - addCompletion "tag -v $($_)" '' "tag --- $($_)" + addCompletion "tag -d $($_)" "tag --- $($_)" + addCompletion "tag -v $($_)" "tag --- $($_)" } foreach ($_ in git stash list --encoding=gbk 2>$null) { if ($_ -match 'stash@\{(\d+)\}') { $stashId = $matches[1] - addCompletion "stash show $stashId" '' $_ - addCompletion "stash pop $stashId" '' $_ - addCompletion "stash apply $stashId" '' $_ - addCompletion "stash drop $stashId" '' $_ + addCompletion "stash show $stashId" $_ + addCompletion "stash pop $stashId" $_ + addCompletion "stash apply $stashId" $_ + addCompletion "stash drop $stashId" $_ } } return $tempList + $completions diff --git a/completions/psc/hooks.ps1 b/completions/psc/hooks.ps1 index 8ba5806..7551f5a 100644 --- a/completions/psc/hooks.ps1 +++ b/completions/psc/hooks.ps1 @@ -1,5 +1,5 @@ function handleCompletions([System.Collections.Generic.List[System.Object]]$completions) { - function addCompletion($name, $symbol = '', $tip = ' ') { + function addCompletion($name, $tip = ' ', $symbol = '') { $completions.Add(@{ name = $name symbol = $symbol @@ -8,68 +8,68 @@ function handleCompletions([System.Collections.Generic.List[System.Object]]$comp } foreach ($completion in $PSCompletions.cmd.Keys) { - addCompletion "rm $($completion)" '' $PSCompletions.replace_content($PSCompletions.info.rm.tip) + addCompletion "rm $($completion)" $PSCompletions.replace_content($PSCompletions.info.rm.tip) - addCompletion "which $($completion)" '' $PSCompletions.replace_content($PSCompletions.info.which.tip) + addCompletion "which $($completion)" $PSCompletions.replace_content($PSCompletions.info.which.tip) - addCompletion "alias add $($completion)" '' $PSCompletions.replace_content($PSCompletions.info.alias.add.tip) + addCompletion "alias add $($completion)" $PSCompletions.replace_content($PSCompletions.info.alias.add.tip) - addCompletion "alias rm $($completion)" 'SpaceTab' $PSCompletions.replace_content($PSCompletions.info.alias.rm.tip) + addCompletion "alias rm $($completion)" $PSCompletions.replace_content($PSCompletions.info.alias.rm.tip) 'SpaceTab' foreach ($alias in $PSCompletions.cmd.$completion) { - addCompletion "alias rm $($completion) $($alias)" '' $PSCompletions.replace_content($PSCompletions.info.alias.rm.tip_v) + addCompletion "alias rm $($completion) $($alias)" $PSCompletions.replace_content($PSCompletions.info.alias.rm.tip_v) } - addCompletion "completion $($completion)" 'SpaceTab' $PSCompletions.replace_content($PSCompletions.info.completion.tip) - addCompletion "completion $($completion) language" 'SpaceTab' $PSCompletions.replace_content($PSCompletions.info.completion.language.tip) - addCompletion "completion $($completion) menu_show_tip" 'SpaceTab' $PSCompletions.replace_content($PSCompletions.info.completion.menu_show_tip.tip) + addCompletion "completion $($completion)" $PSCompletions.replace_content($PSCompletions.info.completion.tip) 'SpaceTab' + addCompletion "completion $($completion) language" $PSCompletions.replace_content($PSCompletions.info.completion.language.tip) 'SpaceTab' + addCompletion "completion $($completion) menu_show_tip" $PSCompletions.replace_content($PSCompletions.info.completion.menu_show_tip.tip) 'SpaceTab' - addCompletion "completion $($completion) menu_show_tip 1" '' $PSCompletions.replace_content($PSCompletions.info.completion.menu_show_tip.tip_v1) - addCompletion "completion $($completion) menu_show_tip 0" '' $PSCompletions.replace_content($PSCompletions.info.completion.menu_show_tip.tip_v0) + addCompletion "completion $($completion) menu_show_tip 1" $PSCompletions.replace_content($PSCompletions.info.completion.menu_show_tip.tip_v1) + addCompletion "completion $($completion) menu_show_tip 0" $PSCompletions.replace_content($PSCompletions.info.completion.menu_show_tip.tip_v0) $language = $PSCompletions.get_language($completion) $config = $PSCompletions.get_raw_content("$($PSCompletions.path.completions)/$($completion)/config.json") | ConvertFrom-Json $json = $PSCompletions.get_raw_content("$($PSCompletions.path.completions)/$($completion)/language/$($language).json") | ConvertFrom-Json foreach ($language in $config.language) { - addCompletion "completion $($completion) language $($language)" '' $PSCompletions.replace_content($PSCompletions.info.completion.language.tip_v) + addCompletion "completion $($completion) language $($language)" $PSCompletions.replace_content($PSCompletions.info.completion.language.tip_v) } foreach ($c in $json.config) { $tip = $PSCompletions.replace_content($c.tip) -replace '<\@\w+>', '' if ($c.values) { - addCompletion "completion $($completion) $($c.name)" 'SpaceTab' $tip + addCompletion "completion $($completion) $($c.name)" $tip 'SpaceTab' foreach ($value in $c.values) { - addCompletion "completion $($completion) $($c.name) $($value)" '' $PSCompletions.replace_content($PSCompletions.info.completion.tip_v) + addCompletion "completion $($completion) $($c.name) $($value)" $PSCompletions.replace_content($PSCompletions.info.completion.tip_v) } } else { - addCompletion "completion $($completion) $($c.name)" '' $tip + addCompletion "completion $($completion) $($c.name)" $tip } $config_item = $c.name - addCompletion "reset completion $($completion) $($config_item)" '' $PSCompletions.replace_content($PSCompletions.info.reset.completion.tip_v) + addCompletion "reset completion $($completion) $($config_item)" $PSCompletions.replace_content($PSCompletions.info.reset.completion.tip_v) } - addCompletion "reset alias $($completion)" '' $PSCompletions.replace_content($PSCompletions.info.reset.alias.tip) + addCompletion "reset alias $($completion)" $PSCompletions.replace_content($PSCompletions.info.reset.alias.tip) $symbol = if ($json.config) { 'SpaceTab' }else { '' } - addCompletion "reset completion $($completion)" $symbol $PSCompletions.replace_content($PSCompletions.info.reset.completion.tip) + addCompletion "reset completion $($completion)" $PSCompletions.replace_content($PSCompletions.info.reset.completion.tip) $symbol } foreach ($completion in $PSCompletions.list) { if ($completion -notin $PSCompletions.cmd.Keys) { - addCompletion "add $($completion)" '' $PSCompletions.replace_content($PSCompletions.info.add.tip) + addCompletion "add $($completion)" $PSCompletions.replace_content($PSCompletions.info.add.tip) } } foreach ($completion in $PSCompletions.update) { - addCompletion "update $($completion)" '' $PSCompletions.replace_content($PSCompletions.info.update.tip) + addCompletion "update $($completion)" $PSCompletions.replace_content($PSCompletions.info.update.tip) } foreach ($item in $PSCompletions.menu.const.color_item) { foreach ($color in $PSCompletions.menu.const.color_value) { - addCompletion "menu custom color $($item) $($color)" '' $PSCompletions.replace_content($PSCompletions.info.menu.custom.color.tip) + addCompletion "menu custom color $($item) $($color)" $PSCompletions.replace_content($PSCompletions.info.menu.custom.color.tip) } } return $completions diff --git a/completions/scoop/hooks.ps1 b/completions/scoop/hooks.ps1 index 8997202..0b5a239 100644 --- a/completions/scoop/hooks.ps1 +++ b/completions/scoop/hooks.ps1 @@ -1,5 +1,5 @@ function handleCompletions([System.Collections.Generic.List[System.Object]]$completions) { - function addCompletion($name, $symbol = '', $tip = ' ') { + function addCompletion($name, $tip = ' ', $symbol = '') { $completions.Add(@{ name = $name symbol = $symbol @@ -29,22 +29,22 @@ function handleCompletions([System.Collections.Generic.List[System.Object]]$comp } foreach ($_ in scoop bucket known) { $bucket = $_ - addCompletion "bucket add $($bucket)" '' $PSCompletions.replace_content($PSCompletions.data.scoop.info.tip.bucket.add) + addCompletion "bucket add $($bucket)" $PSCompletions.replace_content($PSCompletions.data.scoop.info.tip.bucket.add) } foreach ($_ in Get-ChildItem "$scoop_path\buckets" 2>$null) { $bucket = $_.Name - addCompletion "bucket rm $($bucket)" '' $PSCompletions.replace_content($PSCompletions.data.scoop.info.tip.bucket.rm) + addCompletion "bucket rm $($bucket)" $PSCompletions.replace_content($PSCompletions.data.scoop.info.tip.bucket.rm) } foreach ($_ in @("$scoop_path\apps", "$scoop_global_path\apps")) { foreach ($item in (Get-ChildItem $_ 2>$null)) { $app = $item.Name $path = $item.FullName - addCompletion "uninstall $($app)" '' $PSCompletions.replace_content($PSCompletions.data.scoop.info.tip.uninstall) - addCompletion "update $($app)" '' $PSCompletions.replace_content($PSCompletions.data.scoop.info.tip.update) - addCompletion "cleanup $($app)" '' $PSCompletions.replace_content($PSCompletions.data.scoop.info.tip.cleanup) - addCompletion "hold $($app)" '' $PSCompletions.replace_content($PSCompletions.data.scoop.info.tip.hold) - addCompletion "unhold $($app)" '' $PSCompletions.replace_content($PSCompletions.data.scoop.info.tip.unhold) - addCompletion "prefix $($app)" '' $PSCompletions.replace_content($PSCompletions.data.scoop.info.tip.prefix) + addCompletion "uninstall $($app)" $PSCompletions.replace_content($PSCompletions.data.scoop.info.tip.uninstall) + addCompletion "update $($app)" $PSCompletions.replace_content($PSCompletions.data.scoop.info.tip.update) + addCompletion "cleanup $($app)" $PSCompletions.replace_content($PSCompletions.data.scoop.info.tip.cleanup) + addCompletion "hold $($app)" $PSCompletions.replace_content($PSCompletions.data.scoop.info.tip.hold) + addCompletion "unhold $($app)" $PSCompletions.replace_content($PSCompletions.data.scoop.info.tip.unhold) + addCompletion "prefix $($app)" $PSCompletions.replace_content($PSCompletions.data.scoop.info.tip.prefix) } } foreach ($_ in Get-ChildItem "$scoop_path\cache" -ErrorAction SilentlyContinue) { @@ -53,7 +53,7 @@ function handleCompletions([System.Collections.Generic.List[System.Object]]$comp $part = $_.Name -split "#" $path = $_.FullName $cache = $part[0..1] -join "#" - addCompletion "cache rm $($cache)" '' $PSCompletions.replace_content($PSCompletions.data.scoop.info.tip.cache.rm) + addCompletion "cache rm $($cache)" $PSCompletions.replace_content($PSCompletions.data.scoop.info.tip.cache.rm) } } } diff --git a/completions/wsl/hooks.ps1 b/completions/wsl/hooks.ps1 index 397b885..4fde4c9 100644 --- a/completions/wsl/hooks.ps1 +++ b/completions/wsl/hooks.ps1 @@ -1,5 +1,5 @@ function handleCompletions([System.Collections.Generic.List[System.Object]]$completions) { - function addCompletion($name, $symbol = '', $tip = ' ') { + function addCompletion($name, $tip = ' ', $symbol = '') { $completions.Add(@{ name = $name symbol = $symbol @@ -19,20 +19,20 @@ function handleCompletions([System.Collections.Generic.List[System.Object]]$comp foreach ($_ in $Distro_list) { if ($_ -ne '') { $Distro = $_ - addCompletion "~ -d $($Distro)" '' $PSCompletions.replace_content($PSCompletions.data.wsl.info.tip.'--distribution') - addCompletion "-d $($Distro)" '' $PSCompletions.replace_content($PSCompletions.data.wsl.info.tip.'--distribution') - addCompletion "~ --distribution $($Distro)" '' $PSCompletions.replace_content($PSCompletions.data.wsl.info.tip.'--distribution') - addCompletion "--distribution $($Distro)" '' $PSCompletions.replace_content($PSCompletions.data.wsl.info.tip.'--distribution') + addCompletion "~ -d $($Distro)" $PSCompletions.replace_content($PSCompletions.data.wsl.info.tip.'--distribution') + addCompletion "-d $($Distro)" $PSCompletions.replace_content($PSCompletions.data.wsl.info.tip.'--distribution') + addCompletion "~ --distribution $($Distro)" $PSCompletions.replace_content($PSCompletions.data.wsl.info.tip.'--distribution') + addCompletion "--distribution $($Distro)" $PSCompletions.replace_content($PSCompletions.data.wsl.info.tip.'--distribution') - addCompletion "-s $($Distro)" '' $PSCompletions.replace_content($PSCompletions.data.wsl.info.tip.'--distribution') - addCompletion "--set-default $($Distro)" '' $PSCompletions.replace_content($PSCompletions.data.wsl.info.tip.'--set-default') + addCompletion "-s $($Distro)" $PSCompletions.replace_content($PSCompletions.data.wsl.info.tip.'--distribution') + addCompletion "--set-default $($Distro)" $PSCompletions.replace_content($PSCompletions.data.wsl.info.tip.'--set-default') - addCompletion "-t $($Distro)" '' $PSCompletions.replace_content($PSCompletions.data.wsl.info.tip.'--set-default') - addCompletion "--terminate $($Distro)" '' $PSCompletions.replace_content($PSCompletions.data.wsl.info.tip.'--terminate') + addCompletion "-t $($Distro)" $PSCompletions.replace_content($PSCompletions.data.wsl.info.tip.'--set-default') + addCompletion "--terminate $($Distro)" $PSCompletions.replace_content($PSCompletions.data.wsl.info.tip.'--terminate') - addCompletion "--unregister $($Distro)" '' $PSCompletions.replace_content($PSCompletions.data.wsl.info.tip.'--unregister') + addCompletion "--unregister $($Distro)" $PSCompletions.replace_content($PSCompletions.data.wsl.info.tip.'--unregister') - addCompletion "--export $($Distro)" '' $PSCompletions.replace_content($PSCompletions.data.wsl.info.tip.'--export') + addCompletion "--export $($Distro)" $PSCompletions.replace_content($PSCompletions.data.wsl.info.tip.'--export') } } return $completions