File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ if (-not (Test-Path $repoParentPath)) {
129129 New-Item - ItemType Directory - Force - Path $repoParentPath
130130}
131131function updateRepo {
132- params (
132+ param (
133133 [string ]$Path
134134 )
135135 # 检查是否为 Git 仓库
@@ -155,11 +155,20 @@ function updateRepo {
155155 # }
156156}
157157
158+ $totalRepos = $finalRepos.Count
159+ $currentRepo = 0
160+
158161foreach ($repo in $finalRepos ) {
162+ $currentRepo ++
159163 $repoName = $repo.name
160164 $repoUrl = $repo.clone_url
161165 $repoPath = " $repoParentPath \$repoName "
162166
167+ # 显示进度
168+ Write-Progress - Activity " 正在处理仓库" - Status " $currentRepo /$totalRepos - $repoName " `
169+ - PercentComplete (($currentRepo / $totalRepos ) * 100 ) `
170+ - CurrentOperation " 正在下载/更新仓库"
171+
163172 # 检查是否已经存在该目录
164173 if (-not (Test-Path - Path $repoPath )) {
165174 gh repo clone $repoUrl $repoPath
@@ -171,5 +180,8 @@ foreach ($repo in $finalRepos) {
171180 }
172181}
173182
183+ # 完成后清除进度条
184+ Write-Progress - Activity " 完成" - Completed
185+
174186
175187
You can’t perform that action at this time.
0 commit comments