Skip to content

Commit

Permalink
Merge pull request #40 from abgox/module
Browse files Browse the repository at this point in the history
fix(module): update version to 5.0.6
  • Loading branch information
abgox authored Oct 26, 2024
2 parents 2edb201 + a522317 commit fadbe35
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 6 deletions.
5 changes: 5 additions & 0 deletions module/CHANGELOG-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
<a href="./CHANGELOG-CN.md">简体中文</a>
</p>

## 5.0.6 (2024/10/26)

- 修复了目录路径补全没有尾部路径分隔符的问题
- 其他的优化和修复。

## 5.0.5 (2024/9/2)

-`$PSCompletions` 中添加一个方法 `return_completion` 用于 `hooks.ps1`
Expand Down
15 changes: 15 additions & 0 deletions module/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
[
{
"version": "5.0.6",
"info": {
"zh-CN": [
"修复(2024/10/26)\n",
"- 修复了目录路径补全没有尾部路径分隔符的问题。\n",
"- 其他的优化和修复。\n"
],
"en-US": [
"Fix(2024/10/26)\n",
"- Fix directory path completion without trailing path separators.\n",
"- Other optimizations and fixes.\n"
]
}
},
{
"version": "5.0.5",
"info": {
Expand Down
5 changes: 5 additions & 0 deletions module/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
<a href="./CHANGELOG.md">English</a>
</p>

## 5.0.6 (2024/10/26)

- Fix directory path completion without trailing path separators.
- Other optimizations and fixes.

## 5.0.5 (2024/9/2)

- Add a method `return_completion` in `$PSCompletions` for `hooks.ps1`.
Expand Down
3 changes: 2 additions & 1 deletion module/PSCompletions/PSCompletions.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@{
RootModule = 'PSCompletions.psm1'

ModuleVersion = '5.0.5'
ModuleVersion = '5.0.6'

GUID = '00929632-527d-4dab-a5b3-21197faccd05'

Expand All @@ -22,6 +22,7 @@
CompatiblePSEditions = @('Core', 'Desktop')

Description = 'A completion manager for better and simpler use PowerShell completions.
It provides a better GUI-style tab-completion menu to enhance the command line experience.
For more information, please visit the project or website:
- Website: https://pscompletions.pages.dev
- Github: https://github.com/abgox/PSCompletions
Expand Down
5 changes: 3 additions & 2 deletions module/PSCompletions/core/init.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using namespace System.Management.Automation
$_ = Split-Path $PSScriptRoot -Parent
New-Variable -Name PSCompletions -Value @{
version = '5.0.5'
version = '5.0.6'
path = @{
root = $_
completions = Join-Path $_ 'completions'
Expand All @@ -14,6 +14,7 @@ New-Variable -Name PSCompletions -Value @{
order = [ordered]@{}
language = $PSUICulture
encoding = [console]::OutputEncoding
separator = [System.IO.Path]::DirectorySeparatorChar
wc = New-Object System.Net.WebClient
menu = @{
const = @{
Expand Down Expand Up @@ -1013,7 +1014,7 @@ Add-Member -InputObject $PSCompletions -MemberType ScriptMethod init_data {
$PSCompletions.list = ($PSCompletions.get_raw_content($PSCompletions.path.completions_json) | ConvertFrom-Json).list

$PSCompletions.update = $PSCompletions.get_content($PSCompletions.path.update)
if ($PSCompletions._update_version -or 'psc' -notin $PSCompletions.data.list) {
if ('psc' -notin $PSCompletions.data.list -or $PSCompletions._update_version) {
$PSCompletions.add_completion('psc', $false, $false)
$PSCompletions.data | ConvertTo-Json -Depth 100 -Compress | Out-File $PSCompletions.path.data -Force -Encoding utf8
$PSCompletions._update_version = $null
Expand Down
18 changes: 16 additions & 2 deletions module/PSCompletions/core/menu/win.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,20 @@ Add-Member -InputObject $PSCompletions.menu -MemberType ScriptMethod reset {
Add-Member -InputObject $PSCompletions.menu -MemberType ScriptMethod show_module_menu {
param($filter_list, [bool]$enable_menu_enhance)

function handleOutput($item) {
$out = $item.CompletionText
try {
if ((Get-ItemProperty ($item.ToolTip)).Attributes -like '*Directory*') {
if ($out -like "* *") {
return $out.Insert($out.Length - 1, $PSCompletions.separator)
}
return $out + $PSCompletions.separator
}
}
catch {}
return $out
}

if (!$filter_list) { return }

$lastest_encoding = [console]::OutputEncoding
Expand Down Expand Up @@ -659,7 +673,7 @@ Add-Member -InputObject $PSCompletions.menu -MemberType ScriptMethod show_module
$PSCompletions.menu.handle_list_first($filter_list)

if ($PSCompletions.config.enable_enter_when_single -and $PSCompletions.menu.filter_list.Count -eq 1) {
return $PSCompletions.menu.filter_list[$PSCompletions.menu.selected_index].CompletionText
return handleOutput $PSCompletions.menu.filter_list[$PSCompletions.menu.selected_index]
}
$PSCompletions.menu.parse_list()

Expand Down Expand Up @@ -748,7 +762,7 @@ Add-Member -InputObject $PSCompletions.menu -MemberType ScriptMethod show_module
}
13 {
# 13: Enter
$PSCompletions.menu.filter_list[$PSCompletions.menu.selected_index].CompletionText
handleOutput $PSCompletions.menu.filter_list[$PSCompletions.menu.selected_index]
$PSCompletions.menu.reset($true)
break loop
}
Expand Down
2 changes: 1 addition & 1 deletion module/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.5
5.0.6

0 comments on commit fadbe35

Please sign in to comment.