dotnet-file 1.6.2
dotnet tool install --global dotnet-file --version 1.6.2
此软件包包含一个 .NET 工具,您可以从 Shell/命令行调用。
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local dotnet-file --version 1.6.2
此软件包包含一个 .NET 工具,您可以从 Shell/命令行调用。
#tool dotnet:?package=dotnet-file&version=1.6.2
NuGet 团队不提供对此客户端的支持。请联系其 维护者 以获取支持。
nuke :add-package dotnet-file --version 1.6.2
NuGet 团队不提供对此客户端的支持。请联系其 维护者 以获取支持。
一个用于从任意 URL 下载和更新散文件的 dotnet 全局工具。
安装或更新(可以使用相同的命令进行安装和更新)
dotnet tool update -g dotnet-file
获取 CI 版本
dotnet tool update -g dotnet-file --no-cache --add-source https://pkg.kzu.io/index.json
用法
dotnet file [add|changes|delete|list|sync|update] [file or url]*
Actions
add downloads a file or GitHub repository or directory from a URL
changes checks remote URLs for changes and lists the status of local files
delete deletes a file and its corresponding config entry from the local directory
init initializes the local directory from one or more remote .netconfig files
list lists the config entries and the status of their corresponding files
sync synchronizes with remote URLs, deleting local files and directories as needed
update updates local files from remote URLs, does not prune deleted remote files
Status
= <- [url] remote file equals local file
✓ <- [url] local file updated with remote file
^ <- [url] remote file is newer (ETags mismatch)
? <- [url] local file not found for remote file
x <- [url] error processing the entry
动作之后的所有参数都将自动尝试进行 URL 解析,以区分文件(本地路径)和 URL(远程文件位置)。
示例
dotnet file init [url] // seeds the current directory with all files/URLs listed in a remote URL
dotnet file add [url] // downloads a file to the current directory and adds its URL+ETag in dotnet-config
dotnet file add [url] [file] // downloads the url to the (relative) file local path specifed and adds
// its URL+ETag in dotnet-config
dotnet file add [url] . // downloads the url to the current directory and stores URL+ETag in dotnet-config,
// ignoring the source directory structure
dotnet file add [url] docs/ // downloads the url to the specified directory, preserving the source directory structure
dotnet file add [url] docs/. // downloads the url to the specified directory, flattening the source directory structure
dotnet file update [file] // updates a specific file, based on its dotnet-config configuration
dotnet file update [url] // updates a specific file by its url, based on its dotnet-config configuration
dotnet file update // updates all recorded files, according to the dotnet-config configuration
dotnet file sync // just like update, but also prunes files/folders removed from their remote urls
dotnet file delete [file] // deletes a local file and its entry in .netconfig
dotnet file list // lists all configured files
dotnet file changes // lists all configured files and their status with regards to the configured
// remote URL and ETag matching
目标路径按以下规则确定
- 如果
[file]
=.
:下载到当前目录,忽略源目录结构。 - 如果
[url]
以/
结尾:下载到当前目录,保留从该点开始以后的源目录结构(即 GitHub tree/dir URLs)。 - 否则,匹配源文件的目录结构。
下载文件后,在本地 .netconfig
文件中创建一个新的条目,该条目利用了 dotnet config
[file "relative file path"]
url = [url]
etag = [etag]
此信息用于稍后根据需要更新文件内容,通过发出条件 http get 来获取更新。通常建议提交 .netconfig 文件到源控制,这样更新只是运行 dotnet file update
的事情。
注意:
dotnet file update [url]
当在.netconfig
文件中找不到文件的匹配条目时,其行为与dotnet file add [url]
相同。
如果您想跳过对文件的进一步同步,可以在整个命令中添加 skip
[file "readme.md"]
url = [url]
skip
符号用于表示对文件的操作(待处理或已执行)
√
:文件没有待处理的更新(ETag 匹配)或它刚刚成功下载。^
:文件有挂起的更新(ETag 不匹配远程)。=
:更新不需要对文件做出任何更改。?
:本地找不到文件。可以从远程下载新版本。x
:无法更新文件或刷新 ETag 状态,原因在下一行中注明。
通过GitHub CLI支持下载整个存储库或其内部的特定目录,但需要预先安装。您可以通过运行以下GH CLI命令来验证您已成功配置属性认证和访问权限:
gh repo view org/repo
如果您能查看输出(将是仓库的README),则可以使用dotnet-file
下载其中的文件。
通过Git凭证管理器核心项目,支持从GitHub和BitBucket访问私有仓库。
在添加文件时,可以通过指定绝对或相对文件路径来自定义本地文件位置,如下所示:
src/External/File.cs
:完全自定义目标文件路径,无需与源URI文件名或目录结构匹配。src/External/
:将给定目录作为基础目录,但保留源URI目录结构和文件名。src/External/.
:将文件下载到给定目录,不复制源URI目录结构,仅使用源文件名。.
(单个点字符作为目标路径):将文件下载到当前目录,不保持源URI目录结构,仅使用源文件名。
具体示例
> dotnet file add https://github.com/devlooped/dotnet-file/blob/main/azure-pipelines.yml
azure-pipelines.yml √ <- https://github.com/devlooped/dotnet-file/blob/main/azure-pipelines.yml
> dotnet file add https://github.com/devlooped/dotnet-file/blob/main/docs/img/icon.png img/icon.png
img/icon.png √ <- https://github.com/devlooped/dotnet-file/blob/main/docs/img/icon.png
> dotnet file list
azure-pipelines.yml = <- https://github.com/devlooped/dotnet-file/blob/main/azure-pipelines.yml
img/icon.png = <- https://github.com/devlooped/dotnet-file/blob/main/docs/img/icon.png
> del img\icon.png
> dotnet file list
azure-pipelines.yml = <- https://github.com/devlooped/dotnet-file/blob/main/azure-pipelines.yml
img/icon.png ? <- https://github.com/devlooped/dotnet-file/blob/main/docs/img/icon.png
# missing file downloaded successfully
> dotnet file update
azure-pipelines.yml = <- https://github.com/devlooped/dotnet-file/blob/main/azure-pipelines.yml
img/icon.png √ <- https://github.com/devlooped/dotnet-file/blob/main/docs/img/icon.png
# file updated on remote, changes detected
> dotnet file changes
azure-pipelines.yml ^ <- https://github.com/devlooped/dotnet-file/blob/main/azure-pipelines.yml
img/icon.png = <- https://github.com/devlooped/dotnet-file/blob/main/docs/img/icon.png
# file renamed or deleted from remote
> dotnet file changes
azure-pipelines.yml = <- https://github.com/devlooped/dotnet-file/raw/main/azure-pipelines.yml
img/icon.png x <- https://github.com/devlooped/dotnet-file/blob/main/docs/img/icon.png
404: Not Found
# download entire directory to local dir matching remote folder structure
> dotnet file add https://github.com/dotnet/runtime/tree/main/docs/coding-guidelines/api-guidelines
api-guidelines => fetching via gh cli...
docs/coding-guidelines/api-guidelines/README.md √ <- https://github.com/dotnet/runtime/main/docs/coding-guidelines/api-guidelines/README.md
docs/coding-guidelines/api-guidelines/System.Memory.md √ <- https://github.com/dotnet/runtime/main/docs/coding-guidelines/api-guidelines/System.Memory.md
docs/coding-guidelines/api-guidelines/nullability.md √ <- https://github.com/dotnet/runtime/main/docs/coding-guidelines/api-guidelines/nullability.md
...
# download entire directory to a local subdirectory, from where dir structure will match remote structure
> dotnet file add https://github.com/dotnet/runtime/tree/main/docs/coding-guidelines/api-guidelines external/dotnet/
external/dotnet/ => fetching via gh cli...
external/dotnet/docs/coding-guidelines/api-guidelines/README.md √ <- https://github.com/dotnet/runtime/blob/main/docs/coding-guidelines/api-guidelines/README.md
external/dotnet/docs/coding-guidelines/api-guidelines/System.Memory.md √ <- https://github.com/dotnet/runtime/blob/main/docs/coding-guidelines/api-guidelines/System.Memory.md
external/dotnet/docs/coding-guidelines/api-guidelines/nullability.md √ <- https://github.com/dotnet/runtime/blob/main/docs/coding-guidelines/api-guidelines/nullability.md
...
赞助商
产品 | 版本 兼容的和额外的计算目标框架版本。 |
---|---|
.NET | net8.0兼容。 net8.0-android已计算。 net8.0-browser已计算。 net8.0-ios已计算。 net8.0-maccatalyst已计算。 net8.0-macos已计算。 net8.0-tvos已计算。 net8.0-windows已计算。 |
此包无依赖项。
版本 | 下载 | 最后更新 |
---|---|---|
1.6.2 | 6,255 | 7/8/2024 |
1.5.1-beta | 133 | 4/9/2024 |
1.5.0 | 758 | 6/25/2024 |
1.4.1 | 53,679 | 11/17/2022 |
1.4.0 | 7,232 | 6/29/2022 |
1.3.1 | 8,642 | 10/27/2021 |
1.3.0 | 1,013 | 10/4/2021 |
1.2.1 | 1,901 | 7/16/2021 |
1.2.0 | 1,483 | 5/7/2021 |
1.0.1 | 1,924 | 3/1/2021 |
1.0.0 | 331 | 2/26/2021 |
0.9.4 | 430 | 1/25/2021 |
0.9.3 | 721 | 12/15/2020 |
0.9.2 | 420 | 12/10/2020 |
0.9.1 | 419 | 12/9/2020 |
0.9.0 | 396 | 12/8/2020 |
0.2.46 | 387 | 12/8/2020 |
0.2.41 | 400 | 12/5/2020 |
0.2.40 | 436 | 10/24/2020 |
0.2.39 | 571 | 9/26/2020 |
0.2.38 | 569 | 9/26/2020 |
0.2.37 | 553 | 9/26/2020 |
0.2.36 | 559 | 9/26/2020 |
0.2.34 | 573 | 9/26/2020 |
0.2.33 | 425 | 8/26/2020 |
0.2.32 | 430 | 8/26/2020 |
0.2.31 | 427 | 8/26/2020 |
0.2.28 | 438 | 8/25/2020 |
0.2.27 | 467 | 8/25/2020 |
0.2.26 | 459 | 8/25/2020 |
0.2.25 | 480 | 8/25/2020 |
0.2.24 | 578 | 8/21/2020 |
0.2.23 | 431 | 8/20/2020 |
0.2.22 | 464 | 8/20/2020 |
0.2.21 | 473 | 8/16/2020 |
0.2.20 | 443 | 8/16/2020 |
0.2.19 | 452 | 8/16/2020 |
0.2.18 | 515 | 8/16/2020 |
0.2.17 | 518 | 8/16/2020 |
0.2.16 | 612 | 5/22/2020 |
0.2.13 | 481 | 5/21/2020 |
0.2.12 | 504 | 5/21/2020 |
0.2.11 | 467 | 5/21/2020 |
0.2.10 | 466 | 5/21/2020 |
0.2.9 | 473 | 4/30/2020 |
0.2.8 | 464 | 4/30/2020 |
0.2.7 | 501 | 4/30/2020 |
0.2.6 | 500 | 3/6/2020 |