diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 0db9ceb..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-
-/data/SAO-lib.txt
-/data/vars/MSYSRootPath.txt
diff --git a/README.md b/README.md
index 0ec09d1..d5877f4 100644
--- a/README.md
+++ b/README.md
@@ -7,11 +7,9 @@
- 在windows terminal中将字体设置为[`FriaCode Nerd Font`](https://github.com/ryanoasis/nerd-fonts/releases/latest/download/FiraCode.zip)
- 你或许想追加`-NoProfileLoadTime -nologo`到powershell启动参数中
+- 运行`install.ps1`或下方的快速开始命令
- 修改`$EshellUI.MSYS.RootPath`为你的msys2安装路径并`$EshellUI.SaveVariables()`
- 视需要修改其他文件内容
-- 使用`add2profile.ps1`将esh添加到你的powershell配置文件中
-- 使用`run.ps1`启动esh
-- 考虑添加`esh/path`到你的环境变量中
## 快速开始
@@ -22,9 +20,6 @@
```
-
-
-
如果你正在使用它,你可以这样更新:
```powershell
diff --git a/add2profile.ps1 b/add2profile.ps1
deleted file mode 100644
index 51cfcc2..0000000
--- a/add2profile.ps1
+++ /dev/null
@@ -1,37 +0,0 @@
-$profilesDir = Split-Path $profile
-$thisDir = $PSScriptRoot
-if ($thisDir -like "$profilesDir[\\/]?*") {
- $thisDir = $thisDir -replace "^$($profilesDir -replace "\\","\\")[\\/]?",'$PSScriptRoot/'
-}
-$startScript = ". $thisDir/run.ps1"
-$universalProfile = "$profilesDir/profile.ps1"
-function checkLoaded ($theProfile) {
- $loaded = $false
- Get-Content $theProfile -ErrorAction Ignore | ForEach-Object {
- if ($_ -like $startScript) {
- $loaded = $true
- }
- }
- return $loaded
-}
-$added = $false
-@(
- $universalProfile
- $profile
-) | ForEach-Object {
- $loaded = checkLoaded $_
- if ($loaded) {
- Write-Warning "在${_}中已经加载过esh"
- $added = $true
- }
- elseif (Test-Path $_) {
- Add-Content $_ $startScript
- Write-Host "已在${_}中添加加载esh的语句"
- $added = $true
- }
-}
-if (-not $added) {
- Write-Warning "未找到可用的profile文件,新建通用profile文件${universalProfile}"
- New-Item -ItemType Directory -Force -Path $profilesDir | Out-Null
- Set-Content $universalProfile $startScript
-}
diff --git a/data/.gitignore b/data/.gitignore
new file mode 100644
index 0000000..7a8627a
--- /dev/null
+++ b/data/.gitignore
@@ -0,0 +1,2 @@
+/SAO-lib.txt
+/vars/MSYSRootPath.txt
diff --git a/data/formatxml/ls.Terminal-Icons.format.ps1xml b/data/formatxml/ls.Terminal-Icons.format.ps1xml
index 18badfd..1962a4c 100644
--- a/data/formatxml/ls.Terminal-Icons.format.ps1xml
+++ b/data/formatxml/ls.Terminal-Icons.format.ps1xml
@@ -3,175 +3,175 @@
-
-
- FileSystemTypes
-
- System.IO.DirectoryInfo
- System.IO.FileInfo
-
-
-
+
+
+ FileSystemTypes
+
+ System.IO.DirectoryInfo
+ System.IO.FileInfo
+
+
+
-
-
- children
-
- FileSystemTypes
-
-
-
-
-
- 7
- left
-
-
-
- 25
- right
-
-
-
- 14
- right
-
-
-
-
-
-
-
-
-
-
- Mode
-
-
-
- [String]::Format('{0,10} {1,8}', $_.LastWriteTime.ToString('d'), $_.LastWriteTime.ToString('t'))
-
-
-
- Length
-
-
-
- Terminal-Icons\Format-TerminalIcons $_
-
-
-
-
-
-
-
-
- children
-
- FileSystemTypes
-
-
-
-
-
- System.IO.FileInfo
-
-
-
-
-
- Terminal-Icons\Format-TerminalIcons $_
-
-
-
- Length
-
-
- CreationTime
-
-
- LastWriteTime
-
-
- LastAccessTime
-
-
- Mode
-
-
- LinkType
-
-
-
-
- Terminal-Icons\Format-TerminalIcons $_
-
-
-
-
-
-
-
-
-
-
- Terminal-Icons\Format-TerminalIcons $_
-
-
-
- CreationTime
-
-
- LastWriteTime
-
-
- LastAccessTime
-
-
- Mode
-
-
- LinkType
-
-
-
-
- Terminal-Icons\Format-TerminalIcons $_
-
-
-
-
-
-
-
-
- children
-
- FileSystemTypes
-
-
-
-
-
-
- Terminal-Icons\Format-TerminalIcons $_
-
-
-
-
-
- System.IO.DirectoryInfo
-
-
-
- Terminal-Icons\Format-TerminalIcons $_
-
-
-
-
-
-
-
+
+
+ children
+
+ FileSystemTypes
+
+
+
+
+
+ 7
+ left
+
+
+
+ 25
+ right
+
+
+
+ 14
+ right
+
+
+
+
+
+
+
+
+
+
+ Mode
+
+
+
+ [String]::Format('{0,10} {1,8}', $_.LastWriteTime.ToString('d'), $_.LastWriteTime.ToString('t'))
+
+
+
+ Length
+
+
+
+ Terminal-Icons\Format-TerminalIcons $_
+
+
+
+
+
+
+
+
+ children
+
+ FileSystemTypes
+
+
+
+
+
+ System.IO.FileInfo
+
+
+
+
+
+ Terminal-Icons\Format-TerminalIcons $_
+
+
+
+ Length
+
+
+ CreationTime
+
+
+ LastWriteTime
+
+
+ LastAccessTime
+
+
+ Mode
+
+
+ LinkType
+
+
+
+
+ Terminal-Icons\Format-TerminalIcons $_
+
+
+
+
+
+
+
+
+
+
+ Terminal-Icons\Format-TerminalIcons $_
+
+
+
+ CreationTime
+
+
+ LastWriteTime
+
+
+ LastAccessTime
+
+
+ Mode
+
+
+ LinkType
+
+
+
+
+ Terminal-Icons\Format-TerminalIcons $_
+
+
+
+
+
+
+
+
+ children
+
+ FileSystemTypes
+
+
+
+
+
+
+ Terminal-Icons\Format-TerminalIcons $_
+
+
+
+
+
+ System.IO.DirectoryInfo
+
+
+
+ Terminal-Icons\Format-TerminalIcons $_
+
+
+
+
+
+
+
diff --git a/data/formatxml/ls.bare.format.ps1xml b/data/formatxml/ls.bare.format.ps1xml
index 525bb8c..dec524b 100644
--- a/data/formatxml/ls.bare.format.ps1xml
+++ b/data/formatxml/ls.bare.format.ps1xml
@@ -1,194 +1,194 @@
-
-
-
-
- children
-
- System.IO.DirectoryInfo
-
-
-
-
-
- 7
- Left
-
-
-
- 26
- Right
-
-
-
- 14
- Right
-
-
-
- Left
-
-
-
-
-
-
-
- ModeWithoutHardLink
-
-
- LastWriteTimeString
-
-
- LengthString
-
-
- NameString
-
-
-
-
-
-
-
- childrenWithHardlink
-
- System.IO.DirectoryInfo
-
-
-
-
-
- 7
- Left
-
-
-
- 26
- Right
-
-
-
- 14
- Right
-
-
-
- Left
-
-
-
-
-
-
-
- Mode
-
-
- LastWriteTimeString
-
-
- LengthString
-
-
- NameString
-
-
-
-
-
-
-
- children
-
- System.IO.DirectoryInfo
-
-
-
-
-
-
- Name
-
-
- CreationTime
-
-
- LastWriteTime
-
-
- LastAccessTime
-
-
- Mode
-
-
- LinkType
-
-
- Target
-
-
-
-
-
- System.IO.FileInfo
-
-
-
- Name
-
-
-
- LengthString
-
-
- CreationTime
-
-
- LastWriteTime
-
-
- LastAccessTime
-
-
- Mode
-
-
- LinkType
-
-
- Target
-
-
- VersionInfo
-
-
-
-
-
-
-
- children
-
- System.IO.DirectoryInfo
-
-
-
-
-
- Name
-
-
-
-
- System.IO.DirectoryInfo
-
-
- Name
-
-
-
-
-
-
-
+
+
+
+
+ children
+
+ System.IO.DirectoryInfo
+
+
+
+
+
+ 7
+ Left
+
+
+
+ 26
+ Right
+
+
+
+ 14
+ Right
+
+
+
+ Left
+
+
+
+
+
+
+
+ ModeWithoutHardLink
+
+
+ LastWriteTimeString
+
+
+ LengthString
+
+
+ NameString
+
+
+
+
+
+
+
+ childrenWithHardlink
+
+ System.IO.DirectoryInfo
+
+
+
+
+
+ 7
+ Left
+
+
+
+ 26
+ Right
+
+
+
+ 14
+ Right
+
+
+
+ Left
+
+
+
+
+
+
+
+ Mode
+
+
+ LastWriteTimeString
+
+
+ LengthString
+
+
+ NameString
+
+
+
+
+
+
+
+ children
+
+ System.IO.DirectoryInfo
+
+
+
+
+
+
+ Name
+
+
+ CreationTime
+
+
+ LastWriteTime
+
+
+ LastAccessTime
+
+
+ Mode
+
+
+ LinkType
+
+
+ Target
+
+
+
+
+
+ System.IO.FileInfo
+
+
+
+ Name
+
+
+
+ LengthString
+
+
+ CreationTime
+
+
+ LastWriteTime
+
+
+ LastAccessTime
+
+
+ Mode
+
+
+ LinkType
+
+
+ Target
+
+
+ VersionInfo
+
+
+
+
+
+
+
+ children
+
+ System.IO.DirectoryInfo
+
+
+
+
+
+ Name
+
+
+
+
+ System.IO.DirectoryInfo
+
+
+ Name
+
+
+
+
+
+
+
diff --git a/desktop.ini b/desktop.ini
index 2c99a24..b36bcfc 100644
--- a/desktop.ini
+++ b/desktop.ini
@@ -1,4 +1,2 @@
[.ShellClassInfo]
IconResource=C:\WINDOWS\System32\SHELL32.dll,267
-[ViewState]
-FolderType=Documents
diff --git a/install.ps1 b/install.ps1
index 654e281..7df36c3 100644
--- a/install.ps1
+++ b/install.ps1
@@ -1,25 +1,23 @@
-#!/usr/bin/env pwsh
+#!/usr/bin/env pwsh
+using namespace System.Management.Automation
+
$profilesDir = Split-Path $PROFILE
# 遍历环境变量
$env:Path.Split(";") | ForEach-Object {
+ if ($_ -and (-not (Test-Path $_ -PathType Container))) {
+ Write-Warning "检测到无效的环境变量于$_,请考虑删除"
+ return
+ }
if ($_ -like "*[\\/]esh[\\/]path*") {
- if(Test-Path $_ -PathType Container){
- $eshDir = $_ -replace "[\\/]path[\\/]*$",''
- $eshDirFromEnv = $true
- }
- else{
- Write-Warning "检测到无效的esh环境变量于$_,请考虑删除"
- }
+ $eshDir = $_ -replace "[\\/]path[\\/]*$", ''
+ $eshDirFromEnv = $true
}
}
-if (-not $eshDir){
+if (-not $eshDir) {
$eshDir =
- if(Test-Path $profilesDir/esh) {
- "$profilesDir/esh"
- }
- elseif(Test-Path $PWD/path/esh) {
- $PWD
- }
+ if (Test-Path $EshellUI.Sources.Path) { $EshellUI.Sources.Path }
+ elseif (Test-Path $profilesDir/esh) { "$profilesDir/esh" }
+ elseif (Test-Path $PWD/path/esh) { $PWD }
}
New-Item -ItemType Directory -Force -Path $profilesDir | Out-Null
if (-not $eshDir) {
@@ -30,30 +28,32 @@ if (-not $eshDir) {
Remove-Item Eshell.zip -Force
Move-Item $profilesDir/esh-master $profilesDir/esh -Force
$eshDir = "$profilesDir/esh"
+ Invoke-WebRequest 'https://github.com/steve02081504/SAO-lib/raw/master/SAO-lib.txt' -OutFile "$eshDir/data/SAO-lib.txt"
}
-else{
+else {
Write-Host "检测到已安装 Esh 于 $eshDir"
}
-function Choice($caption, $message) {
+function YorN($message, [switch]$defaultN = $false) {
do {
- $response = $Host.UI.PromptForChoice($caption, $message, @('&Yes', '&No'), 1)
+ $response = $Host.UI.PromptForChoice("", $message, @('&Yes', '&No'), $(if($defaultN){1}else{0}))
} until ($response -ne -1)
$response -eq 0
}
-if ((-not $eshDirFromEnv) -and (Choice("", "你想要安装 Eshell 到环境变量吗?"))) {
- $env:Path += ";$profilesDir/esh/path"
- $UserPath = [Environment]::GetEnvironmentVariable("Path", "User") + ";$profilesDir/esh/path"
+if ((-not $eshDirFromEnv) -and (YorN "要安装 Eshell 到环境变量吗?")) {
+ $env:Path += ";$eshDir/path"
+ $UserPath = [Environment]::GetEnvironmentVariable("Path", "User") + ";$eshDir/path"
[Environment]::SetEnvironmentVariable("Path", $UserPath, "User")
- Write-Host "安装成功!`n你现在可以在任何地方使用 ``esh`` 或 ``EShell`` 命令了。"
+ Write-Host "安装成功!`n现在可以在任何地方使用 ``esh`` 或 ``EShell`` 命令了。"
+ $eshDirFromEnv = $true
}
$profilEshDir = $eshDir
if ($profilEshDir -like "$profilesDir[\\/]?*") {
- $profilEshDir = $profilEshDir -replace "^$($profilesDir -replace "\\","\\")[\\/]?",'$PSScriptRoot/'
+ $profilEshDir = $profilEshDir -replace "^$($profilesDir -replace "\\","\\")[\\/]?", '$PSScriptRoot/'
}
$startScript = ". $profilEshDir/run.ps1"
$universalProfile = "$profilesDir/profile.ps1"
function checkLoaded ($theProfile) {
- (Get-Content $theProfile -ErrorAction Ignore) -ccontains $startScript
+ (Get-Content $theProfile -ErrorAction Ignore) -contains $startScript
}
$added = $false
@(
@@ -66,7 +66,7 @@ $added = $false
$added = $true
}
}
-if ((-not $added) -and (Choice("", "你想要添加 Eshell 到 PowerShell 配置文件吗?"))) {
+if ((-not $added) -and (YorN "要添加 Eshell 到 PowerShell 配置文件吗?" -defaultN:$true)) {
@(
$universalProfile
$profile
@@ -82,8 +82,53 @@ if ((-not $added) -and (Choice("", "你想要添加 Eshell 到 PowerShell 配置
Set-Content $universalProfile $startScript
}
}
-if(-not $EshellUI) {
- . $eshDir/run.ps1 -Invocation $MyInvocation
+$hasWT = [bool]$(Get-Command wt.exe -ErrorAction Ignore)
+if ($hasWT) {
+ $wtFragmentDir = "$env:LOCALAPPDATA\Microsoft\Windows Terminal\Fragments\esh"
+ $BaseWtProfile = @{
+ name = "Eshell"
+ icon = "ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png"
+ commandline = "$(if(-not $eshDirFromEnv) { "$eshDir/path/" })esh.cmd -WorkingDirectory ~"
+ hidden = $false
+ }
+ $RootWtProfile = [PSSerializer]::Deserialize([PSSerializer]::Serialize($BaseWtProfile))
+ $RootWtProfile.name = "Eshell (Root)"
+ $RootWtProfile.elevate = $true
+ $wtFragment = @{
+ schema = "https://aka.ms/terminal-profiles-schema"
+ profiles = @( $BaseWtProfile, $RootWtProfile )
+ }
+ if ($PSVersionTable.PSVersion.Major -lt 6) {
+ $wtFragmentJson = ($wtFragment | ConvertTo-Json).Replace("`r`n", "`n")
+ }
+ else{
+ $wtFragmentJson = ($wtFragment | ConvertTo-Json -EnumsAsStrings).Replace("`r`n", "`n")
+ }
+ if(-not (Test-Path $wtFragmentDir/esh.json)) {}
+ elseif (Test-Path $wtFragmentDir/esh.json) {
+ if (-not (Compare-Object (Get-Content $wtFragmentDir/esh.json | ConvertFrom-Json) $wtFragment)) {
+ Set-Content $wtFragmentDir/esh.json $wtFragmentJson -NoNewline
+ Write-Warning "检测到旧的 Eshell Windows Terminal 配置文件,其已被更新。"
+ }
+ }
+ elseif(YorN "要添加 Eshell 到 Windows Terminal 吗?") {
+ New-Item -ItemType Directory -Force -Path $wtFragmentDir | Out-Null
+ Set-Content $wtFragmentDir/esh.json $wtFragmentJson -NoNewline
+ }
+}
+
+if ($PSVersionTable.PSVersion.Major -lt 6) {
+ if(-not (YorN "你需要知道:esh的运行需要PowerShell 6或以上")) {
+ Write-Host "爬。"
+ }
+}
+if ((-not $EshellUI) -and (YorN "要使用 Eshell 吗?")) {
+ if ($PSVersionTable.PSVersion.Major -lt 6) {
+ . $eshDir/run.cmd
+ }
+ else {
+ . $eshDir/run.ps1 -Invocation $MyInvocation
+ }
}
-Remove-Variable @("profilesDir", "eshDir", "startScript", "universalProfile", "added", "profilEshDir", "eshDirFromEnv") -ErrorAction Ignore
-Remove-Item @("function:Choice", "function:checkLoaded", "function:Choice") -ErrorAction Ignore
+Remove-Variable @("profilesDir", "eshDir", "startScript", "universalProfile", "added", "wtFragmentJson", "profilEshDir", "eshDirFromEnv", "hasWT", "wtFragmentDir", "wtFragment", "UserPath", "BaseWtProfile", "RootWtProfile") -ErrorAction Ignore
+Remove-Item @("function:YorN", "function:checkLoaded") -ErrorAction Ignore
diff --git a/main.ps1 b/main.ps1
index af27df5..f425732 100644
--- a/main.ps1
+++ b/main.ps1
@@ -1,4 +1,4 @@
-if ($PSVersionTable.PSVersion.Major -lt 6) {
+if ($PSVersionTable.PSVersion.Major -lt 6) {
$Host.UI.WriteErrorLine('PowerShell 6 or higher is required for E-ShellUI.')
exit 1
}
diff --git a/path/Eshell b/path/Eshell
index 7c0d34d..f1dd912 100644
--- a/path/Eshell
+++ b/path/Eshell
@@ -2,4 +2,4 @@
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
-$SCRIPT_DIR/../run.sh "$@"
+$SCRIPT_DIR/../run "$@"
diff --git a/path/esh b/path/esh
index 7c0d34d..f1dd912 100644
--- a/path/esh
+++ b/path/esh
@@ -2,4 +2,4 @@
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
-$SCRIPT_DIR/../run.sh "$@"
+$SCRIPT_DIR/../run "$@"
diff --git a/run.sh b/run
similarity index 57%
rename from run.sh
rename to run
index 4e630be..6b4dff6 100644
--- a/run.sh
+++ b/run
@@ -2,7 +2,6 @@
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
-# Parse and process remaining arguments
while [[ $# -gt 0 ]]; do
case "$1" in
-Command)
@@ -20,29 +19,17 @@ while [[ $# -gt 0 ]]; do
;;
esac
done
-
-# Store parsed remaining arguments in a new variable
parsed_args="${remaining_args[@]}"
# 测试/c/Windows以确定是否在Windows上运行
if [[ -d "/c/Windows" ]]; then
- # 在Windows上运行
# 对$SCRIPT_DIR进行Windows路径转换
- # 例如:/c/Users/username/Desktop -> C:\Users\username\Desktop
# 我们不能使用wslpath,因为它不是所有Linux发行版或msys的一部分
SCRIPT_DIR=$(echo "$SCRIPT_DIR" | sed -e 's/\/c/C:/g' -e 's/\//\\/g' -e 's/^\\//g')
fi
if [[ -z "$command" ]]; then
- if [[ -z "$parsed_args" ]]; then
- pwsh -nologo -NoExit -File "$SCRIPT_DIR/run.ps1"
- else
- pwsh "$parsed_args" -nologo -NoExit -File "$SCRIPT_DIR/run.ps1"
- fi
+ pwsh $parsed_args -nologo -NoExit -File "$SCRIPT_DIR/run.ps1"
else
- if [[ -z "$parsed_args" ]]; then
- pwsh -nologo -Command ". $SCRIPT_DIR/run.ps1 ; & $command"
- else
- pwsh "$parsed_args" -nologo -Command ". $SCRIPT_DIR/run.ps1 ; & $command"
- fi
+ pwsh $parsed_args -nologo -Command ". $SCRIPT_DIR/run.ps1 ; & $command"
fi
diff --git a/run.ps1 b/run.ps1
index 9f8f9ea..348afcb 100644
--- a/run.ps1
+++ b/run.ps1
@@ -1,4 +1,5 @@
-[CmdletBinding()]param($Invocation = $MyInvocation)
+#!/usr/bin/env pwsh
+[CmdletBinding()]param($Invocation = $MyInvocation)
if (-not $EshellUI) { . $PSScriptRoot/main.ps1 }
if (-not $EshellUI) { exit 1 }
diff --git a/src/commands/coffee.ps1 b/src/commands/coffee.ps1
index a6af94f..9580e92 100644
--- a/src/commands/coffee.ps1
+++ b/src/commands/coffee.ps1
@@ -1,4 +1,4 @@
-function global:coffee { "
+function global:coffee { "
( (
) )
.______.
diff --git a/src/commands/copilot.ps1 b/src/commands/copilot.ps1
index ddda01f..c872225 100644
--- a/src/commands/copilot.ps1
+++ b/src/commands/copilot.ps1
@@ -1,4 +1,4 @@
-function global:Install-Copilot {
+function global:Install-Copilot {
if (-not (Test-Command gh)) {
#github cli not found
if (Test-Command winget) {
diff --git a/src/commands/esh_base.ps1 b/src/commands/esh_base.ps1
index 278b285..d86698d 100644
--- a/src/commands/esh_base.ps1
+++ b/src/commands/esh_base.ps1
@@ -1,4 +1,4 @@
-if (-not (Test-Command esh.cmd)) {
+if (-not (Test-Command esh.cmd)) {
function global:EShell {
pwsh -nologo $(if ($PSVersionTable.PSVersion -gt 7.3) { '-NoProfileLoadTime' })
}
diff --git a/src/commands/other.ps1 b/src/commands/other.ps1
index e0460b5..1afb6a2 100644
--- a/src/commands/other.ps1
+++ b/src/commands/other.ps1
@@ -1,4 +1,4 @@
-function global:mklink {
+function global:mklink {
param(
[Parameter(ValueFromRemainingArguments = $true)]
[string[]]$RemainingArguments
diff --git a/src/commands/special/BlueStacks.ps1 b/src/commands/special/BlueStacks.ps1
index 5c637d6..18872a6 100644
--- a/src/commands/special/BlueStacks.ps1
+++ b/src/commands/special/BlueStacks.ps1
@@ -1,4 +1,4 @@
-function global:Install-apk {
+function global:Install-apk {
param(
[Parameter(Mandatory = $true)]
[string]$apkPath
diff --git a/src/commands/special/linux_bins.ps1 b/src/commands/special/linux_bins.ps1
index 14b0eb3..424af99 100644
--- a/src/commands/special/linux_bins.ps1
+++ b/src/commands/special/linux_bins.ps1
@@ -1,4 +1,4 @@
-#让我们升级cd来让它可以处理linux路径
+#让我们升级cd来让它可以处理linux路径
while (Test-Path Alias:cd) {
Remove-Item Alias:cd
}
diff --git a/src/commands/update.ps1 b/src/commands/update.ps1
index 8645329..684c383 100644
--- a/src/commands/update.ps1
+++ b/src/commands/update.ps1
@@ -1,4 +1,4 @@
-function global:Update-SAO-lib {
+function global:Update-SAO-lib {
$espath = $EshellUI.Sources.Path
try {
#下载最新的SAO-lib
diff --git a/src/main.ps1 b/src/main.ps1
index a7fa848..e81e2fd 100644
--- a/src/main.ps1
+++ b/src/main.ps1
@@ -1,4 +1,4 @@
-. $PSScriptRoot/scripts/ValueEx.ps1
+. $PSScriptRoot/scripts/ValueEx.ps1
$EshellUI ??= $LastExitCode = $this = 72 #Do not remove this line
$EshellUI = ValueEx @{
diff --git a/src/scripts/CHT2CHS.map.ps1 b/src/scripts/CHT2CHS.map.ps1
index 4ed7554..4e4110c 100644
--- a/src/scripts/CHT2CHS.map.ps1
+++ b/src/scripts/CHT2CHS.map.ps1
@@ -1,4 +1,4 @@
-${global:CHSCHT.oridata.words} = @{
+${global:CHSCHT.oridata.words} = @{
'窗棂' = '窗櫺';
'鼻梁' = '鼻樑';
'脊梁' = '脊樑';
diff --git a/src/scripts/CHT2CHS.ps1 b/src/scripts/CHT2CHS.ps1
index 3ab90e2..920261c 100644
--- a/src/scripts/CHT2CHS.ps1
+++ b/src/scripts/CHT2CHS.ps1
@@ -1,4 +1,4 @@
-. $PSScriptRoot\CHT2CHS.map.ps1
+. $PSScriptRoot\CHT2CHS.map.ps1
[hashtable]${global:CHT2CHS.data.words} = @{}
[hashtable]${global:CHS2CHT.data.words} = @{}
diff --git a/src/scripts/Console.ps1 b/src/scripts/Console.ps1
index 566e55b..1cefb46 100644
--- a/src/scripts/Console.ps1
+++ b/src/scripts/Console.ps1
@@ -1,11 +1,11 @@
-# 导入Win32 API函数
-Add-Type @"
- using System;
- using System.Runtime.InteropServices;
- public class Win32 {
- [DllImport("user32.dll", CharSet = CharSet.Auto)]
- public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
- }
+# 导入Win32 API函数
+Add-Type @"
+ using System;
+ using System.Runtime.InteropServices;
+ public class Win32 {
+ [DllImport("user32.dll", CharSet = CharSet.Auto)]
+ public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
+ }
"@
# 设置窗口icon
diff --git a/src/scripts/TestCommand.ps1 b/src/scripts/TestCommand.ps1
index 134a134..c2cd5ca 100644
--- a/src/scripts/TestCommand.ps1
+++ b/src/scripts/TestCommand.ps1
@@ -1,4 +1,4 @@
-function global:Test-Command {
+function global:Test-Command {
param(
$Command
)
diff --git a/src/scripts/Ukagaka.ps1 b/src/scripts/Ukagaka.ps1
index 3c83fb0..60f9531 100644
--- a/src/scripts/Ukagaka.ps1
+++ b/src/scripts/Ukagaka.ps1
@@ -1,4 +1,4 @@
-function global:Get-Ukagaka-Description-File-HashTable {
+function global:Get-Ukagaka-Description-File-HashTable {
param(
[Parameter(Mandatory = $true)]
$Content
diff --git a/src/scripts/ValueEx.ps1 b/src/scripts/ValueEx.ps1
index 607780b..c5620d7 100644
--- a/src/scripts/ValueEx.ps1
+++ b/src/scripts/ValueEx.ps1
@@ -1,4 +1,4 @@
-function global:ValueEx ($ValueAndMethods) {
+function global:ValueEx ($ValueAndMethods) {
if ($ValueAndMethods.__value__) {
if ($ValueAndMethods.__type__) {
$ValueExed = $ValueAndMethods.__type__($ValueAndMethods.__value__)
diff --git a/src/scripts/VirtualTerminal.ps1 b/src/scripts/VirtualTerminal.ps1
index 75c8dba..265e6a0 100644
--- a/src/scripts/VirtualTerminal.ps1
+++ b/src/scripts/VirtualTerminal.ps1
@@ -1,4 +1,4 @@
-if ($Host.UI.SupportsVirtualTerminal) {
+if ($Host.UI.SupportsVirtualTerminal) {
function Escape { [char]27 + '[' + $args }
$global:VirtualTerminal = @{
Escape = Escape
diff --git a/src/scripts/shell_args_convert.ps1 b/src/scripts/shell_args_convert.ps1
index 0a92e46..739db56 100644
--- a/src/scripts/shell_args_convert.ps1
+++ b/src/scripts/shell_args_convert.ps1
@@ -1,4 +1,4 @@
-function global:cmd_args_convert {
+function global:cmd_args_convert {
param(
$Arguments
)
diff --git a/src/system/BackgroundLoading.ps1 b/src/system/BackgroundLoading.ps1
index a678361..12a2c8d 100644
--- a/src/system/BackgroundLoading.ps1
+++ b/src/system/BackgroundLoading.ps1
@@ -1,4 +1,4 @@
-$EshellUI.BackgroundLoadingJobs.AddRange(@(
+$EshellUI.BackgroundLoadingJobs.AddRange(@(
{
Update-FormatData -PrependPath "$($EshellUI.Sources.Path)/data/formatxml/ls.bare.format.ps1xml"
if ($Host.UI.SupportsVirtualTerminal) {
diff --git a/src/system/Fixer.ps1 b/src/system/Fixer.ps1
index b626755..3ed158b 100644
--- a/src/system/Fixer.ps1
+++ b/src/system/Fixer.ps1
@@ -1,4 +1,4 @@
-if ([System.Environment]::OSVersion.Version.Major -le 7) {
+if ([System.Environment]::OSVersion.Version.Major -le 7) {
$CursorPosBackUp = $host.UI.RawUI.CursorPosition
$CodingBackUp = [Console]::OutputEncoding
$TestText = '中文测试你好小笼包我是冰激凌'
diff --git a/src/system/UI/hints.ps1 b/src/system/UI/hints.ps1
index 041bba6..fca9951 100644
--- a/src/system/UI/hints.ps1
+++ b/src/system/UI/hints.ps1
@@ -1,4 +1,4 @@
-$EshellUI.Hints = ValueEx @{
+$EshellUI.Hints = ValueEx @{
__type__ = [System.Collections.ArrayList]
'method:AddWithCommand' = {
param(
diff --git a/src/system/UI/icon.ps1 b/src/system/UI/icon.ps1
index 3c1518f..1867e4c 100644
--- a/src/system/UI/icon.ps1
+++ b/src/system/UI/icon.ps1
@@ -1,4 +1,4 @@
-. "$($EshellUI.Sources.Path)/src/scripts/Console.ps1"
+. "$($EshellUI.Sources.Path)/src/scripts/Console.ps1"
Set-ConsoleIcon "$($EshellUI.Sources.Path)/img/cmd.ico"
Remove-Item function:Set-ConsoleIcon
Remove-Item function:Set-WindowIcon
diff --git a/src/system/UI/loaded.ps1 b/src/system/UI/loaded.ps1
index 600870b..707fc30 100644
--- a/src/system/UI/loaded.ps1
+++ b/src/system/UI/loaded.ps1
@@ -1,4 +1,4 @@
-if ($error.Count -eq $EshellUI.OtherData.BeforeEshLoaded.Errors.Count) {
+if ($error.Count -eq $EshellUI.OtherData.BeforeEshLoaded.Errors.Count) {
$CursorPos = $host.UI.RawUI.CursorPosition
$CursorPos.Y -= 3
$host.UI.RawUI.CursorPosition = $CursorPos
diff --git a/src/system/UI/loading.ps1 b/src/system/UI/loading.ps1
index 65298ee..b2c5037 100644
--- a/src/system/UI/loading.ps1
+++ b/src/system/UI/loading.ps1
@@ -1,4 +1,4 @@
-if ($EshellUI.Im.VSCodeExtension -and (-not $EshellUI.OtherData.ReloadSafeVariables.VSCodeExtensionHostCleared)) {
+if ($EshellUI.Im.VSCodeExtension -and (-not $EshellUI.OtherData.ReloadSafeVariables.VSCodeExtensionHostCleared)) {
Clear-Host
$EshellUI.OtherData.ReloadSafeVariables.VSCodeExtensionHostCleared = $true
}
diff --git a/src/system/UI/logo.ps1 b/src/system/UI/logo.ps1
index 1cf00de..5e16641 100644
--- a/src/system/UI/logo.ps1
+++ b/src/system/UI/logo.ps1
@@ -1,4 +1,4 @@
-. $PSScriptRoot/hints.ps1
+. $PSScriptRoot/hints.ps1
$EshellUI.Logo = ValueEx @{
Parent = $EshellUI
'method:Print' = {
diff --git a/src/system/UI/prompt/builders/git.ps1 b/src/system/UI/prompt/builders/git.ps1
index 9b55c90..33a647d 100644
--- a/src/system/UI/prompt/builders/git.ps1
+++ b/src/system/UI/prompt/builders/git.ps1
@@ -1,4 +1,4 @@
-$EshellUI.Prompt.Builders['git'] = {
+$EshellUI.Prompt.Builders['git'] = {
param(
[Parameter(Mandatory = $true)]
[string]$prompt_str,
diff --git a/src/system/UI/prompt/builders/npm.ps1 b/src/system/UI/prompt/builders/npm.ps1
index a353e7b..783afc5 100644
--- a/src/system/UI/prompt/builders/npm.ps1
+++ b/src/system/UI/prompt/builders/npm.ps1
@@ -1,4 +1,4 @@
-$EshellUI.Prompt.Builders['npm'] = {
+$EshellUI.Prompt.Builders['npm'] = {
param(
[Parameter(Mandatory = $true)]
[string]$prompt_str,
diff --git a/src/system/UI/prompt/builders/ukagaka.ps1 b/src/system/UI/prompt/builders/ukagaka.ps1
index bb688c8..07c8113 100644
--- a/src/system/UI/prompt/builders/ukagaka.ps1
+++ b/src/system/UI/prompt/builders/ukagaka.ps1
@@ -1,4 +1,4 @@
-. "$($EshellUI.Sources.Path)/src/scripts/Ukagaka.ps1"
+. "$($EshellUI.Sources.Path)/src/scripts/Ukagaka.ps1"
$EshellUI.Prompt.Builders['ukagaka'] = {
param(
[Parameter(Mandatory = $true)]
diff --git a/src/system/UI/prompt/main.ps1 b/src/system/UI/prompt/main.ps1
index 9717eea..a85aab4 100644
--- a/src/system/UI/prompt/main.ps1
+++ b/src/system/UI/prompt/main.ps1
@@ -1,4 +1,4 @@
-$EshellUI.Prompt = ValueEx @{
+$EshellUI.Prompt = ValueEx @{
Parent = $EshellUI
Builders = @{}
BuildMethods = ValueEx @{
diff --git a/src/system/UI/title.ps1 b/src/system/UI/title.ps1
index 7f0e911..5ed7605 100644
--- a/src/system/UI/title.ps1
+++ b/src/system/UI/title.ps1
@@ -1,4 +1,4 @@
-#set the title same as cmd
+#set the title same as cmd
$host.UI.RawUI.WindowTitle = '命令提示符'
#if as root
if ($EshellUI.Im.Sudo) {
diff --git a/src/system/base.ps1 b/src/system/base.ps1
index 33fabd9..482131c 100644
--- a/src/system/base.ps1
+++ b/src/system/base.ps1
@@ -1,2 +1,2 @@
-. "$($EshellUI.Sources.Path)/src/scripts/TestCommand.ps1"
+. "$($EshellUI.Sources.Path)/src/scripts/TestCommand.ps1"
. "$($EshellUI.Sources.Path)/src/scripts/VirtualTerminal.ps1"
diff --git a/src/system/linux.ps1 b/src/system/linux.ps1
index 4cb15bd..2662242 100644
--- a/src/system/linux.ps1
+++ b/src/system/linux.ps1
@@ -1,4 +1,4 @@
-#查找$EshellUI.MSYS.RootPath是否是可用的msys路径
+#查找$EshellUI.MSYS.RootPath是否是可用的msys路径
if (-not $EshellUI.MSYS.RootPath -or -not (Test-Path $EshellUI.MSYS.RootPath)) {
#若不是,则遍历所有盘符
$DriveLetters = Get-PSDrive -PSProvider FileSystem | ForEach-Object { $_.Name }