.NET 5.0 SDK 的發佈,給 dotnet cli 引入了一個新的特性,dotnet tool search
,主要用於搜索 Nuget 上的 dotnet tool,這個命令會搜索 tool 的名稱以及一些元數據, titles, descriptions, 和 tags工具
dotnet tool search [--detail] [--prerelease]
[--skip] [--take code] dotnet tool search -h|--helpblog
能夠經過 dotnet tool search -h
查看支持的參數,支持的參數以下:接口
--detail
ip
顯示詳細結果get
--prerelease
it
是否包含預覽版io
--skip <NUMBER>
cli
跳過前面多少條數據,用於分頁搜索
--take <NUMBER>
指定要返回的數據條數,用於分頁查詢
來看幾個簡單的示例:
使用 dotnet tool search <keyword>
進行最基本的搜索,
使用 dotnet tool search <keyword> --skip <skip> --take <take>
來進行分頁查詢
使用 dotnet tool search <keyword> --take 1 --detail
查詢詳細信息
這個功能從 .NET 5.0 SDK 以後才支持,它的實現方式卻是很簡單,直接調用了 Nuget 的接口,經過 packageType=dotnettool
只查詢 dotnet tool
用抓包工具抓個包看看,search 的時候作了什麼,search 的時候會調用 nuget 的接口,接口調用狀況以下:
有了這個咱們即便不徹底記得 dotnet tool 的名稱,咱們也能夠經過命令進行查詢,方便了不少