1
0

PowerShellでCopilotを使ってみた

Last updated at Posted at 2024-06-13

PowerShellでCopilotを使えるようにした。

なかなか便利である。私の環境では、日本語で入力するとPowerShellだけでなくターミナルもコマンドも、なぜかすべて落ちてしまうので、簡単な英語で質問するだけだが、PowerShellのコマンドを知らない身には、大変にありがたい。

よく使うのが、ファイル検索。PowerShellのコマンド名はやたら長い。

DIR /S *filename*

こんなシンプルにはならない。

PS C:\Users\Windows3_1> copilot suggest 'command same as DIR /S *SSS* on powershell'

Welcome to GitHub Copilot in the CLI!
version 1.0.3 (2024-05-08)

I'm powered by AI, so surprises and mistakes are possible. Make sure to verify any generated code or suggestions, and share feedback so that we can learn and improve. For more information, see https://gh.io/gh-copilot-transparency

? What kind of command can I help you with?
> generic shell command

Suggestion:

  Get-ChildItem -Recurse | Where-Object { $_.Name -like '*SSS*' }

? Select an option
> Copy command to clipboard

Command copied to clipboard!

しかし、copilotでコマンドを教えてくれて、それをクリップボードにまでコピーしてくれるから、非常に楽ちんである。

質問するときに"on powershell"としないと、普通にbashの解説をされてしまう。

もちろん日本語で質問しても、問題なし。

PS C:\Users\Windows3_1> copilot suggest 'powershellで隠しファイルを表示したい'

Welcome to GitHub Copilot in the CLI!
version 1.0.3 (2024-05-08)

I'm powered by AI, so surprises and mistakes are possible. Make sure to verify any generated code or suggestions, and share feedback so that we can learn and improve. For more information, see https://gh.io/gh-copilot-transparency

? What kind of command can I help you with?
> generic shell command

Suggestion:

  Get-ChildItem -Hidden | Select-Object FullName

MS-DOSやunix(Lunixではない!!!)のコマンドは体が覚えている。viは指が自然に動くが、nanoなんて名前も聞いたことが無いから、使ったことが無い。ちなみに、当時でもemacsは使わなかった。

だからPowerShellだのwslとやらのコマンドは、まったくわからぬ!!!!教えたまえ、copilot!!

PS C:\Users\Windows3_1> copilot suggest '現在アクティブなwslインスタンスを表示する'

Welcome to GitHub Copilot in the CLI!
version 1.0.3 (2024-05-08)

I'm powered by AI, so surprises and mistakes are possible. Make sure to verify any generated code or suggestions, and share feedback so that we can learn and improve. For more information, see https://gh.io/gh-copilot-transparency

? What kind of command can I help you with?
> generic shell command

Suggestion:

  wsl --list --running

? Select an option
> Copy command to clipboard

Command copied to clipboard!
PS C:\Users\Windows3_1> wsl --list --running
Linux 用 Windows サブシステム ディストリビューション:
Ubuntu-22.04 (既定)

お前は賢いのぉ。高いくせに何の役にも立たぬMicrosoft Copilotとは、大違いじゃ!!!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0