dotnet tool search
dotnet cli 5.0 新特性——dotnet tool search
Intro
.NET 5.0 SDK 的釋出,給 dotnet cli 引入了一個新的特性,
dotnet tool search
,主要用于搜尋 Nuget 上的 dotnet tool,這個指令會搜尋 tool 的名稱以及一些中繼資料, titles, descriptions, 和 tags
Search
Synopsis
dotnet tool search [--detail] [--prerelease]
[--skip ] [--take ]
dotnet tool search -h|--help
可以通過
dotnet tool search -h
檢視支援的參數,支援的參數如下:
-
顯示詳細結果--detail
-
是否包含預覽版--prerelease
-
跳過前面多少條資料,用于分頁--skip <NUMBER>
-
指定要傳回的資料條數,用于分頁查詢--take <NUMBER>
Examples
來看幾個簡單的示例:
使用
dotnet tool search <keyword>
進行最基本的搜尋,
dotnet tool search <keyword> --skip <skip> --take <take>
來進行分頁查詢

dotnet tool search <keyword> --take 1 --detail
查詢詳細資訊
More
這個功能從 .NET 5.0 SDK 之後才支援,它的實作方式倒是很簡單,直接調用了 Nuget 的接口,通過
packageType=dotnettool
隻查詢 dotnet tool
用抓包工具抓個包看看,search 的時候做了什麼,search 的時候會調用 nuget 的接口,接口調用情況如下:
有了這個我們即使不完全記得 dotnet tool 的名稱,我們也可以通過指令進行查詢,友善了很多
References
- https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-tool-search
本文版權歸作者和部落格園共有,歡迎轉載,但未經作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接配接,否則保留追究法律責任的權利。