PowerShell / PowerShell/PSScriptAnalyzer
Sugguest native (PowerShell) command alternatives to CMD/Unix commands
まだ誰も着手していません。
- 主要言語
- C#
- スター
- 2.2k
- フォーク
- 414
- 平均マージ
- 13時間 1分
- マージ済み PR(30日)
- 2
説明
Summary of the new feature
Following a idea and short chat with @SteveL-MSFT on twitter it occured to me that it might be a fit for PSScriptAnalyzer (see https://twitter.com/Steve_MSFT/status/1083749912439808001 )
I was reminded of a old pdf Ashley McGlone did https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/telligent.evolution.components.attachments/01/8458/00/00/03/54/23/12/PowerShell%20Cmd%20Line%20Conversion%20Guide%20AD.pdf (found on https://blogs.technet.microsoft.com/ashleymcglone/2013/01/02/free-download-cmd-to-powershell-guide-for-ad/ )
It can be hard to discover native PowerShell commands for commands you have used for years in cmd. Example ipconfig (or ifconfig) (if your new to PowerShell you might not even know.
| CMD | Switch | PowerShell Cmdlet | Module | Version |
|---|---|---|---|---|
| IPCONFIG | Get-NetIPConfiguration | NetTCPIP | 2012 | |
| IPCONFIG | /ALL | Get-NetIPConfiguration -Detailed | NetTCPIP | 2012 |
| IPCONFIG | /FLUSHDNS | Clear-DnsClientCache | DnsClient | 2012 |
| IPCONFIG | /DISPLAYDNS | Get-DnsClientCashe | DnsClient | 2012 |
| IPCONFIG | /REGISTERDNS | Register-DnsClient | DnsClient | 2012 |
There's a huge difference between getting the non structured text output from ipconfig and the objects you get from the native commands.
Say a user try to find IP of localhost by using ipconfig in his code PowerShell code. The script analyzer could sugguest using one of the commands above (or even Get-NetIPAddress) as an alternative that will return a object instead of "unstructured" text.
I'm not sure how to come up with a list of comparable commands, but I guess that is excatly why it might be nice.
Proposed technical implementation details (optional)
If the script analyzer could make alternatives visible e.g. in VS Code it might help people out.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
この issue は、CMD および Unix コマンドに対するネイティブな PowerShell の代替手段を analyzer が提案する機能を、ipconfig のマッピングを例として提案しています。リポジトリのファイル、テスト、または analyzer のエントリポイントは特定されていません。まずサポートするコマンドのマッピングを定義し、関連する analyzer の拡張ポイントを特定してから、VS Code で提案をどのように表示するか、また補完をどのように検証するかを確立してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- powershell
- 領域
- tooling
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 30/100