Skip to content

Commit

Permalink
Merge pull request #58 from abgox/module
Browse files Browse the repository at this point in the history
fix(module): update version to 5.1.4
  • Loading branch information
abgox authored Nov 30, 2024
2 parents ca4eb77 + ec9308b commit f3db04b
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 12 deletions.
4 changes: 4 additions & 0 deletions module/CHANGELOG-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
<a href="./CHANGELOG-CN.md">简体中文</a>
</p>

## 5.1.4 (2024/11/30)

- 修复了在 `v5.1.3` 中,混合使用 `PowerShell``Windows PowerShell` 导致边框样式被意外更改的问题。

## 5.1.3 (2024/11/30)

- 修复拥有 `hooks.ps1` 的补全命令的动态补全不生效的问题。
Expand Down
13 changes: 13 additions & 0 deletions module/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
[
{
"version": "5.1.4",
"info": {
"zh-CN": [
"更新(2024/11/30)\n",
"- 修复了在 v5.1.3 中,混合使用 PowerShell 和 Windows PowerShell 导致边框样式被意外更改的问题。\n"
],
"en-US": [
"Update(2024/11/30)\n",
"- Fix the issue of unexpected border style change when using PowerShell and Windows PowerShell together in v5.1.3.\n"
]
}
},
{
"version": "5.1.3",
"info": {
Expand Down
4 changes: 4 additions & 0 deletions module/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
<a href="./CHANGELOG.md">English</a>
</p>

## 5.1.4 (2024/11/30)

- Fix the issue of unexpected border style change when using `PowerShell` and `Windows PowerShell` together in `v5.1.3`.

## 5.1.3 (2024/11/30)

- Fix the issue of dynamic completion not taking effect for commands with `hooks.ps1`.
Expand Down
2 changes: 1 addition & 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.1.3'
ModuleVersion = '5.1.4'

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

Expand Down
19 changes: 19 additions & 0 deletions module/PSCompletions/core/completion/win.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@
return
}

# XXX: 在 Windows PowerShell 5.x 中,边框使用以下符号以处理兼容性问题
if ($PSEdition -ne 'Core') {
$PSCompletions.config.horizontal = '-'
$PSCompletions.config.vertical = '|'
$PSCompletions.config.top_left = '+'
$PSCompletions.config.bottom_left = '+'
$PSCompletions.config.top_right = '+'
$PSCompletions.config.bottom_right = '+'
}

# 是否是按下空格键触发的补全
$space_tab = if ($buffer[-1] -eq ' ') { 1 }else { 0 }
# 使用正则表达式进行分割,将命令行中的每个参数分割出来,形成一个数组, 引号包裹的内容会被当作一个参数,且数组会包含 "--"
Expand Down Expand Up @@ -140,6 +150,15 @@

$filter_list = $PSCompletions.get_completion()
if ($PSCompletions.config.enable_menu -eq 1) {
# XXX: 在 Windows PowerShell 5.x 中,边框使用以下符号以处理兼容性问题
if ($PSEdition -ne 'Core') {
$PSCompletions.config.horizontal = '-'
$PSCompletions.config.vertical = '|'
$PSCompletions.config.top_left = '+'
$PSCompletions.config.bottom_left = '+'
$PSCompletions.config.top_right = '+'
$PSCompletions.config.bottom_right = '+'
}
$PSCompletions.menu.show_module_menu($filter_list)
}
else {
Expand Down
11 changes: 1 addition & 10 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.1.3'
version = '5.1.4'
path = @{
root = $_
completions = Join-Path $_ 'completions'
Expand Down Expand Up @@ -1062,15 +1062,6 @@ Add-Member -InputObject $PSCompletions -MemberType ScriptMethod init_data {
$language = if ($PSCompletions.language -eq 'zh-CN') { 'zh-CN' }else { 'en-US' }
$PSCompletions.info = $PSCompletions.ConvertFrom_JsonToHashtable($PSCompletions.get_raw_content("$($PSCompletions.path.completions)/psc/language/$language.json")).info
}
# XXX: 在 Windows PowerShell 5.x 中,边框使用以下符号以处理兼容性问题
if ($PSEdition -ne 'Core') {
$PSCompletions.config.horizontal = '-'
$PSCompletions.config.vertical = '|'
$PSCompletions.config.top_left = '+'
$PSCompletions.config.bottom_left = '+'
$PSCompletions.config.top_right = '+'
$PSCompletions.config.bottom_right = '+'
}
}
Add-Member -InputObject $PSCompletions.menu -MemberType ScriptMethod get_length {
param([string]$str)
Expand Down
2 changes: 1 addition & 1 deletion module/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.1.3
5.1.4

0 comments on commit f3db04b

Please sign in to comment.