Powershellを扱い、Windowsターミナルを使用可能にする







デフォルトでWindowsの端末がまだ松葉杖であることは周知の事実です。標準端末は、2006年にPowershell端末に置き換えられました。その後、それは画期的なことでしたが、ターミナルは、Bashを備えたLinuxの場合ほど便利ではありませんでした。Microsoft-



は、Powershell構文全体の基礎を形成し、端末をすばやく操作できない、かなり悪いコマンド構文を考え出しましたすぐではありませんが、いくつかのリリースの後、エイリアスが追加されました。最初はcmdからのコマンドを模倣し、次にcp、mv、rm、psなどのbashコマンドを採用しました(実際、これらはコマンドではなく、単にその略語です。標準のPowershellコマンドを参照してください)。







このミニ記事では、Windowsの不便なターミナルエミュレーターの問題と、いくつかの機能の欠如を解決しようとします。







5- (Zsh, Bash, Fish..) - , . . Powershell . . , , . , , .







, Linux?



Linux. , , , . - , , Linux, - , , - , , , - - . , .







Windows , , , , , ( ) , .







Windows — . Linux-like.







Windows Terminal



Windows Terminal. .json



. — . , , (Ctrl + Alt + ,



), ,













colorScheme



, , . .







, , Linux, , .







Powershell



. , , . . 2 : , , , Git', , , , - , ( fish) — .







, , oh-my-posh. :







Install-Module oh-my-posh -Scope CurrentUser #   oh-my-posh
Install-Module posh-git -Scope CurrentUser #    ,    git'
      
      





, Get-Theme



, Set-Theme



:







PS C:\Users\Daniil_Shilo> Get-Theme

Name                  Type     Location
----                  ----     --------
Agnoster              Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\A...
AgnosterPlus          Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\A...
Avit                  Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\A...
cypher                Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\c...
Darkblood             Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\D...
Emodipt               Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\E...
Fish                  Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\F...
Honukai               Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\H...
Lambda                Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\L...
Material              Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\M...
Operator              Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\O...
Paradox               Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\P...
Pararussel            Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\P...
Powerlevel10k-Classic Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\P...
Powerlevel10k-Lean    Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\P...
Powerlevel9k          Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\P...
PowerLine             Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\P...
PowerlinePlus         Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\P...
Punk                  Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\P...
pure                  Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\p...
qwerty                Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\q...
robbyrussell          Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\r...
Sorin                 Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\S...
Star                  Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\S...
tehrob                Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\t...
ys                    Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\y...
Zash                  Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\Z...

Set-Theme ys
      
      











. , .









, Chocolatey. , , Linux- ( ).







:







Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
      
      





Chocolatey, - Google Chrome, Firefox, Docker, VSCode, . , Windows,







, Chocolatey, . . , Approved.




Chocolatey Powershell, , Linux. search.







% choco search Google Chrome
Chocolatey v0.10.15
GoogleChrome 88.0.4324.146 [Approved]
google-hangouts-chrome 2017.110.418.20 [Approved]
google-translate-chrome 2.0.7 [Approved]
...
      
      







( ).







% choco install <_>
      
      





:







% choco list --local-only
      
      





- :







% choco uninstall <_>
      
      







Windowsのターミナルはまだ機能していませんが、LinuxをWindows(WSL)に統合しただけで、遅かれ早かれこれが変わると思います。Windowsターミナルエミュレータに新しい息吹を吹き込むために、人々は新しい何かを考え続けているので、すでにターミナルを落ち着いて使用できると思います。







興味があれば、カート私のブログを読むことができます。Linuxの世界だけでなく、Web開発についても興味深いことがたくさんあります。








All Articles