From 684e01285a7c8d4206213fab23507c082479e886 Mon Sep 17 00:00:00 2001 From: steve02081504 Date: Sat, 25 Nov 2023 16:01:40 +0800 Subject: [PATCH] rebase 2 ./esh --- .github/workflows/CI.ps1 | 2 +- .gitignore | 6 +-- README.md | 46 +++++++++--------- esh/add2profile.ps1 => add2profile.ps1 | 0 .../formatxml/ls.Terminal-Icons.format.ps1xml | 0 .../formatxml/ls.bare.format.ps1xml | 0 {esh/data => data}/vars/placeholder | 0 esh/desktop.ini => desktop.ini | 0 {esh/img => img}/cmd.ico | Bin esh/main.ps1 => main.ps1 | 0 profile.ps1 | 1 - esh/run.ps1 => run.ps1 | 0 {esh/src => src}/commands/coffee.ps1 | 0 {esh/src => src}/commands/copilot.ps1 | 0 {esh/src => src}/commands/esh_base.ps1 | 0 {esh/src => src}/commands/other.ps1 | 0 .../commands/special/BlueStacks.ps1 | 0 .../commands/special/linux_bins.ps1 | 0 {esh/src => src}/commands/update.ps1 | 11 ++--- {esh/src => src}/main.ps1 | 0 {esh/src => src}/scripts/CHT2CHS.map.ps1 | 0 {esh/src => src}/scripts/CHT2CHS.ps1 | 0 {esh/src => src}/scripts/Console.ps1 | 0 {esh/src => src}/scripts/TestCommand.ps1 | 0 {esh/src => src}/scripts/Ukagaka.ps1 | 0 {esh/src => src}/scripts/ValueEx.ps1 | 0 {esh/src => src}/scripts/VirtualTerminal.ps1 | 0 .../scripts/shell_args_convert.ps1 | 0 {esh/src => src}/system/BackgroundLoading.ps1 | 0 {esh/src => src}/system/CodePageFixer.ps1 | 0 {esh/src => src}/system/UI/hints.ps1 | 0 {esh/src => src}/system/UI/icon.ps1 | 0 {esh/src => src}/system/UI/loaded.ps1 | 0 {esh/src => src}/system/UI/loading.ps1 | 0 {esh/src => src}/system/UI/logo.ps1 | 0 .../system/UI/prompt/builders/git.ps1 | 0 .../system/UI/prompt/builders/npm.ps1 | 0 .../system/UI/prompt/builders/ukagaka.ps1 | 0 {esh/src => src}/system/UI/prompt/main.ps1 | 0 {esh/src => src}/system/UI/title.ps1 | 0 {esh/src => src}/system/base.ps1 | 0 {esh/src => src}/system/linux.ps1 | 0 42 files changed, 31 insertions(+), 35 deletions(-) rename esh/add2profile.ps1 => add2profile.ps1 (100%) rename {esh/data => data}/formatxml/ls.Terminal-Icons.format.ps1xml (100%) rename {esh/data => data}/formatxml/ls.bare.format.ps1xml (100%) rename {esh/data => data}/vars/placeholder (100%) rename esh/desktop.ini => desktop.ini (100%) rename {esh/img => img}/cmd.ico (100%) rename esh/main.ps1 => main.ps1 (100%) delete mode 100644 profile.ps1 rename esh/run.ps1 => run.ps1 (100%) rename {esh/src => src}/commands/coffee.ps1 (100%) rename {esh/src => src}/commands/copilot.ps1 (100%) rename {esh/src => src}/commands/esh_base.ps1 (100%) rename {esh/src => src}/commands/other.ps1 (100%) rename {esh/src => src}/commands/special/BlueStacks.ps1 (100%) rename {esh/src => src}/commands/special/linux_bins.ps1 (100%) rename {esh/src => src}/commands/update.ps1 (88%) rename {esh/src => src}/main.ps1 (100%) rename {esh/src => src}/scripts/CHT2CHS.map.ps1 (100%) rename {esh/src => src}/scripts/CHT2CHS.ps1 (100%) rename {esh/src => src}/scripts/Console.ps1 (100%) rename {esh/src => src}/scripts/TestCommand.ps1 (100%) rename {esh/src => src}/scripts/Ukagaka.ps1 (100%) rename {esh/src => src}/scripts/ValueEx.ps1 (100%) rename {esh/src => src}/scripts/VirtualTerminal.ps1 (100%) rename {esh/src => src}/scripts/shell_args_convert.ps1 (100%) rename {esh/src => src}/system/BackgroundLoading.ps1 (100%) rename {esh/src => src}/system/CodePageFixer.ps1 (100%) rename {esh/src => src}/system/UI/hints.ps1 (100%) rename {esh/src => src}/system/UI/icon.ps1 (100%) rename {esh/src => src}/system/UI/loaded.ps1 (100%) rename {esh/src => src}/system/UI/loading.ps1 (100%) rename {esh/src => src}/system/UI/logo.ps1 (100%) rename {esh/src => src}/system/UI/prompt/builders/git.ps1 (100%) rename {esh/src => src}/system/UI/prompt/builders/npm.ps1 (100%) rename {esh/src => src}/system/UI/prompt/builders/ukagaka.ps1 (100%) rename {esh/src => src}/system/UI/prompt/main.ps1 (100%) rename {esh/src => src}/system/UI/title.ps1 (100%) rename {esh/src => src}/system/base.ps1 (100%) rename {esh/src => src}/system/linux.ps1 (100%) diff --git a/.github/workflows/CI.ps1 b/.github/workflows/CI.ps1 index 47ed214..5dd4dfb 100644 --- a/.github/workflows/CI.ps1 +++ b/.github/workflows/CI.ps1 @@ -1,4 +1,4 @@ -. $PSScriptRoot/../../esh/main.ps1 +. $PSScriptRoot/../../main.ps1 try{ $EshellUI.Init($MyInvocation) diff --git a/.gitignore b/.gitignore index 2b28c31..0db9ceb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -/Modules/* -/Scripts/* -/esh/data/SAO-lib.txt -/esh/data/vars/MSYSRootPath.txt +/data/SAO-lib.txt +/data/vars/MSYSRootPath.txt diff --git a/README.md b/README.md index c09b42c..6762418 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,16 @@ -# My powershell profile +# esh -只是个人配置文件。 +原本只是个人配置文件来着 写着写着面向对象了 再写着写着成了一个方便安装的配置包 +究竟是为什么呢 ## 使用方法 -- clone后放置于`~/Documents/powershell` - 在windows terminal中将字体设置为[`FriaCode Nerd Font`](https://github.com/ryanoasis/nerd-fonts/releases/latest/download/FiraCode.zip) - 你或许想追加`-NoProfileLoadTime -nologo`到powershell启动参数中 - 修改`$EshellUI.MSYS.RootPath`为你的msys2安装路径并`$EshellUI.SaveVariables()` - 视需要修改其他文件内容 +- 使用`add2profile.ps1`将esh添加到你的powershell配置文件中 +- 使用`run.ps1`启动esh ## 快速开始 @@ -16,21 +18,19 @@ ```powershell $PwshProFiles = Split-Path $PROFILE -$ParentPath = Split-Path $PwshProFiles +New-Item -ItemType Directory -Force -Path $PwshProFiles | Out-Null Remove-Item $PwshProFiles/esh -Confirm -ErrorAction Ignore -Recurse -Remove-Item $ParentPath/my-powershell-profile-master -Force -ErrorAction SilentlyContinue -Confirm:$false -Recurse -Invoke-WebRequest https://github.com/steve02081504/my-powershell-profile/archive/refs/heads/master.zip -OutFile Eshell.zip -Expand-Archive Eshell.zip $ParentPath -Force +Remove-Item $PwshProFiles/esh-master -Force -ErrorAction Ignore -Confirm:$false -Recurse +Invoke-WebRequest https://github.com/steve02081504/esh/archive/refs/heads/master.zip -OutFile Eshell.zip +Expand-Archive Eshell.zip $PwshProFiles -Force Remove-Item Eshell.zip -Force -New-Item -ItemType Directory -Force -Path $PwshProFiles | Out-Null -Move-Item $ParentPath/my-powershell-profile-master/esh $PwshProFiles/esh -Force -Remove-Item $ParentPath/my-powershell-profile-master -Force -ErrorAction SilentlyContinue -Confirm:$false -Recurse +Move-Item $PwshProFiles/esh-master $PwshProFiles/esh -Force & $PwshProFiles/esh/add2profile.ps1 . $PwshProFiles/esh/run.ps1 -Remove-Variable @('PwshProFiles','ParentPath') +Remove-Variable PwshProFiles ``` -![loading preview](https://github.com/steve02081504/my-powershell-profile/assets/31927825/c7ba3f3f-cdb2-4b93-8fdc-2f5901e0ce12) +![loading preview](https://github.com/steve02081504/esh/assets/31927825/c7ba3f3f-cdb2-4b93-8fdc-2f5901e0ce12) 如果你正在使用它,你可以这样更新: @@ -45,42 +45,42 @@ Update-Eshell ## 功能预览 最低兼容PS7.2.15和Windows 6.1.7601(自动纠正编码设置) -![图片](https://github.com/steve02081504/my-powershell-profile/assets/31927825/e87b0407-f874-4d33-9a04-bda6f8c1658c) +![图片](https://github.com/steve02081504/esh/assets/31927825/e87b0407-f874-4d33-9a04-bda6f8c1658c) 支持VSCode的powershell扩展 -![图片](https://github.com/steve02081504/my-powershell-profile/assets/31927825/f32cdef8-a1fc-42f0-ad1b-64ad87f70a05) +![图片](https://github.com/steve02081504/esh/assets/31927825/f32cdef8-a1fc-42f0-ad1b-64ad87f70a05) ### 提示符 git提示符支持 -![图片](https://github.com/steve02081504/my-powershell-profile/assets/31927825/24808f4d-c1a1-48b0-94a6-da45b6cc4510) +![图片](https://github.com/steve02081504/esh/assets/31927825/24808f4d-c1a1-48b0-94a6-da45b6cc4510) npm提示符支持 -![图片](https://github.com/steve02081504/my-powershell-profile/assets/31927825/66c1732c-da1b-4d62-ad00-93852dc65529) +![图片](https://github.com/steve02081504/esh/assets/31927825/66c1732c-da1b-4d62-ad00-93852dc65529) ukagaka提示符支持 -![图片](https://github.com/steve02081504/my-powershell-profile/assets/31927825/9c3620ca-f15d-4a7d-8e5a-b0d321e58aab) +![图片](https://github.com/steve02081504/esh/assets/31927825/9c3620ca-f15d-4a7d-8e5a-b0d321e58aab) 可以通过修改`esh/src/system/UI/prompt/builders`来便捷自定义提示符 ### 命令 rm、ls、cd、mv等常见文件操作命令支持linux和powershell两种风格调用(需要将msys2的bin添加到path) -![图片](https://github.com/steve02081504/my-powershell-profile/assets/31927825/fdf5e98a-5532-4318-9a81-c5337c6d323a) +![图片](https://github.com/steve02081504/esh/assets/31927825/fdf5e98a-5532-4318-9a81-c5337c6d323a) linux路径支持(包括补全和索引command) -![图片](https://github.com/steve02081504/my-powershell-profile/assets/31927825/da57f8b3-59cc-461c-89c7-801951038245) +![图片](https://github.com/steve02081504/esh/assets/31927825/da57f8b3-59cc-461c-89c7-801951038245) 自动检索AppData -![图片](https://github.com/steve02081504/my-powershell-profile/assets/31927825/08eeaea8-5050-4378-91a2-45713b4b6915) +![图片](https://github.com/steve02081504/esh/assets/31927825/08eeaea8-5050-4378-91a2-45713b4b6915) ### 便捷指令 `poweroff`或`power off`关机(`shutdown`也可以不带参数被调用) -![图片](https://github.com/steve02081504/my-powershell-profile/assets/31927825/a164e5df-661f-47fa-a0fb-364349443410) +![图片](https://github.com/steve02081504/esh/assets/31927825/a164e5df-661f-47fa-a0fb-364349443410) 不用打开cmd,`mklink`也可以直接被使用(并且支持linux路径) -![图片](https://github.com/steve02081504/my-powershell-profile/assets/31927825/d8160647-ce17-4d1a-aca6-eafd48819d8d) +![图片](https://github.com/steve02081504/esh/assets/31927825/d8160647-ce17-4d1a-aca6-eafd48819d8d) 你说得对,但是`sudo`是由前面我忘了 后面我也忘了 @@ -91,6 +91,6 @@ icacls superhavyrock /inheritance:r rm -rf superhavyrock ``` -![图片](https://github.com/steve02081504/my-powershell-profile/assets/31927825/b0b3a4ed-f6fd-446e-a65b-602399bd0abe) +![图片](https://github.com/steve02081504/esh/assets/31927825/b0b3a4ed-f6fd-446e-a65b-602399bd0abe) 由于我懒,`dirsync`等其他命令不做介绍,请自行查看`$EshellUI.ProvidedFunctions()` diff --git a/esh/add2profile.ps1 b/add2profile.ps1 similarity index 100% rename from esh/add2profile.ps1 rename to add2profile.ps1 diff --git a/esh/data/formatxml/ls.Terminal-Icons.format.ps1xml b/data/formatxml/ls.Terminal-Icons.format.ps1xml similarity index 100% rename from esh/data/formatxml/ls.Terminal-Icons.format.ps1xml rename to data/formatxml/ls.Terminal-Icons.format.ps1xml diff --git a/esh/data/formatxml/ls.bare.format.ps1xml b/data/formatxml/ls.bare.format.ps1xml similarity index 100% rename from esh/data/formatxml/ls.bare.format.ps1xml rename to data/formatxml/ls.bare.format.ps1xml diff --git a/esh/data/vars/placeholder b/data/vars/placeholder similarity index 100% rename from esh/data/vars/placeholder rename to data/vars/placeholder diff --git a/esh/desktop.ini b/desktop.ini similarity index 100% rename from esh/desktop.ini rename to desktop.ini diff --git a/esh/img/cmd.ico b/img/cmd.ico similarity index 100% rename from esh/img/cmd.ico rename to img/cmd.ico diff --git a/esh/main.ps1 b/main.ps1 similarity index 100% rename from esh/main.ps1 rename to main.ps1 diff --git a/profile.ps1 b/profile.ps1 deleted file mode 100644 index 256571b..0000000 --- a/profile.ps1 +++ /dev/null @@ -1 +0,0 @@ -. $PSScriptRoot/esh/run.ps1 diff --git a/esh/run.ps1 b/run.ps1 similarity index 100% rename from esh/run.ps1 rename to run.ps1 diff --git a/esh/src/commands/coffee.ps1 b/src/commands/coffee.ps1 similarity index 100% rename from esh/src/commands/coffee.ps1 rename to src/commands/coffee.ps1 diff --git a/esh/src/commands/copilot.ps1 b/src/commands/copilot.ps1 similarity index 100% rename from esh/src/commands/copilot.ps1 rename to src/commands/copilot.ps1 diff --git a/esh/src/commands/esh_base.ps1 b/src/commands/esh_base.ps1 similarity index 100% rename from esh/src/commands/esh_base.ps1 rename to src/commands/esh_base.ps1 diff --git a/esh/src/commands/other.ps1 b/src/commands/other.ps1 similarity index 100% rename from esh/src/commands/other.ps1 rename to src/commands/other.ps1 diff --git a/esh/src/commands/special/BlueStacks.ps1 b/src/commands/special/BlueStacks.ps1 similarity index 100% rename from esh/src/commands/special/BlueStacks.ps1 rename to src/commands/special/BlueStacks.ps1 diff --git a/esh/src/commands/special/linux_bins.ps1 b/src/commands/special/linux_bins.ps1 similarity index 100% rename from esh/src/commands/special/linux_bins.ps1 rename to src/commands/special/linux_bins.ps1 diff --git a/esh/src/commands/update.ps1 b/src/commands/update.ps1 similarity index 88% rename from esh/src/commands/update.ps1 rename to src/commands/update.ps1 index e298a54..8645329 100644 --- a/esh/src/commands/update.ps1 +++ b/src/commands/update.ps1 @@ -22,18 +22,17 @@ function global:Update-gcc-Kawaii { function global:Update-EShell { Update-SAO-lib $espath = $EshellUI.Sources.Path + $praentpath = Split-Path $espath $datapath = "$espath/data" try { #下载最新的EShell - Invoke-WebRequest 'https://github.com/steve02081504/my-powershell-profile/archive/refs/heads/master.zip' -OutFile "$datapath/master.zip" - #解压缩my-powershell-profile-master中的src文件夹到$dataPath - Expand-Archive "$datapath/master.zip" "$datapath" -Force + Invoke-WebRequest 'https://github.com/steve02081504/esh/archive/refs/heads/master.zip' -OutFile "$datapath/master.zip" #删除旧的src以确保干净 Remove-Item "$espath/src" -Recurse -Force #更新文件 - Copy-Item "$datapath/my-powershell-profile-master/esh" "$espath/.." -Recurse -Force - #删除my-powershell-profile-master - Remove-Item "$datapath/my-powershell-profile-master" -Recurse -Force + Rename-Item "$espath" "$praentpath/esh-master" + Expand-Archive "$praentpath/esh-master/data/master.zip" "$praentpath" -Force + Rename-Item "$praentpath/esh-master" "$espath" #删除压缩包 Remove-Item "$datapath/master.zip" -Force #重载EShell diff --git a/esh/src/main.ps1 b/src/main.ps1 similarity index 100% rename from esh/src/main.ps1 rename to src/main.ps1 diff --git a/esh/src/scripts/CHT2CHS.map.ps1 b/src/scripts/CHT2CHS.map.ps1 similarity index 100% rename from esh/src/scripts/CHT2CHS.map.ps1 rename to src/scripts/CHT2CHS.map.ps1 diff --git a/esh/src/scripts/CHT2CHS.ps1 b/src/scripts/CHT2CHS.ps1 similarity index 100% rename from esh/src/scripts/CHT2CHS.ps1 rename to src/scripts/CHT2CHS.ps1 diff --git a/esh/src/scripts/Console.ps1 b/src/scripts/Console.ps1 similarity index 100% rename from esh/src/scripts/Console.ps1 rename to src/scripts/Console.ps1 diff --git a/esh/src/scripts/TestCommand.ps1 b/src/scripts/TestCommand.ps1 similarity index 100% rename from esh/src/scripts/TestCommand.ps1 rename to src/scripts/TestCommand.ps1 diff --git a/esh/src/scripts/Ukagaka.ps1 b/src/scripts/Ukagaka.ps1 similarity index 100% rename from esh/src/scripts/Ukagaka.ps1 rename to src/scripts/Ukagaka.ps1 diff --git a/esh/src/scripts/ValueEx.ps1 b/src/scripts/ValueEx.ps1 similarity index 100% rename from esh/src/scripts/ValueEx.ps1 rename to src/scripts/ValueEx.ps1 diff --git a/esh/src/scripts/VirtualTerminal.ps1 b/src/scripts/VirtualTerminal.ps1 similarity index 100% rename from esh/src/scripts/VirtualTerminal.ps1 rename to src/scripts/VirtualTerminal.ps1 diff --git a/esh/src/scripts/shell_args_convert.ps1 b/src/scripts/shell_args_convert.ps1 similarity index 100% rename from esh/src/scripts/shell_args_convert.ps1 rename to src/scripts/shell_args_convert.ps1 diff --git a/esh/src/system/BackgroundLoading.ps1 b/src/system/BackgroundLoading.ps1 similarity index 100% rename from esh/src/system/BackgroundLoading.ps1 rename to src/system/BackgroundLoading.ps1 diff --git a/esh/src/system/CodePageFixer.ps1 b/src/system/CodePageFixer.ps1 similarity index 100% rename from esh/src/system/CodePageFixer.ps1 rename to src/system/CodePageFixer.ps1 diff --git a/esh/src/system/UI/hints.ps1 b/src/system/UI/hints.ps1 similarity index 100% rename from esh/src/system/UI/hints.ps1 rename to src/system/UI/hints.ps1 diff --git a/esh/src/system/UI/icon.ps1 b/src/system/UI/icon.ps1 similarity index 100% rename from esh/src/system/UI/icon.ps1 rename to src/system/UI/icon.ps1 diff --git a/esh/src/system/UI/loaded.ps1 b/src/system/UI/loaded.ps1 similarity index 100% rename from esh/src/system/UI/loaded.ps1 rename to src/system/UI/loaded.ps1 diff --git a/esh/src/system/UI/loading.ps1 b/src/system/UI/loading.ps1 similarity index 100% rename from esh/src/system/UI/loading.ps1 rename to src/system/UI/loading.ps1 diff --git a/esh/src/system/UI/logo.ps1 b/src/system/UI/logo.ps1 similarity index 100% rename from esh/src/system/UI/logo.ps1 rename to src/system/UI/logo.ps1 diff --git a/esh/src/system/UI/prompt/builders/git.ps1 b/src/system/UI/prompt/builders/git.ps1 similarity index 100% rename from esh/src/system/UI/prompt/builders/git.ps1 rename to src/system/UI/prompt/builders/git.ps1 diff --git a/esh/src/system/UI/prompt/builders/npm.ps1 b/src/system/UI/prompt/builders/npm.ps1 similarity index 100% rename from esh/src/system/UI/prompt/builders/npm.ps1 rename to src/system/UI/prompt/builders/npm.ps1 diff --git a/esh/src/system/UI/prompt/builders/ukagaka.ps1 b/src/system/UI/prompt/builders/ukagaka.ps1 similarity index 100% rename from esh/src/system/UI/prompt/builders/ukagaka.ps1 rename to src/system/UI/prompt/builders/ukagaka.ps1 diff --git a/esh/src/system/UI/prompt/main.ps1 b/src/system/UI/prompt/main.ps1 similarity index 100% rename from esh/src/system/UI/prompt/main.ps1 rename to src/system/UI/prompt/main.ps1 diff --git a/esh/src/system/UI/title.ps1 b/src/system/UI/title.ps1 similarity index 100% rename from esh/src/system/UI/title.ps1 rename to src/system/UI/title.ps1 diff --git a/esh/src/system/base.ps1 b/src/system/base.ps1 similarity index 100% rename from esh/src/system/base.ps1 rename to src/system/base.ps1 diff --git a/esh/src/system/linux.ps1 b/src/system/linux.ps1 similarity index 100% rename from esh/src/system/linux.ps1 rename to src/system/linux.ps1