dotnet cli 5.0 新特性——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 的接口,接口調用情況如下:
有了這個我們即使不完全記得 package tool 的類型,我們也可以通過命令進行查詢,方便了很多
References
https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-tool-search
總結
以上是生活随笔為你收集整理的dotnet cli 5.0 新特性——dotnet tool search的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何在 ASP.Net Core 中使用
- 下一篇: 2021技术领域趋势报告:Rust继续增