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

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM