Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 268459d

Browse files
briefly improve the ux, we will move this task to a different branch
1 parent 24f8ed2 commit 268459d

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

‎Project_Move-ChildItemUp/Helpers/MidLogicHelper/Remove-EmptyFolder.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,13 @@ function Remove-EmptyFolder {
5151
# Use ShouldProcess for confirmation
5252
if ($PSCmdlet.ShouldProcess("$folderPath", "Remove empty folder")) {
5353
Remove-Item -Path $folderPath -Force
54-
Write-Host "Removed empty folder:`n$folderPath" -ForegroundColor Red
54+
Write-Host "Removed empty folder:`n$folderPath" `
55+
-ForegroundColor Red
5556
}
5657
}
5758
else {
58-
Write-Host "Skipped non-empty folder:`n$folderPath" -ForegroundColor Magenta
59+
Write-Host "Skipped non-empty folder:`n$folderPath" `
60+
-ForegroundColor DarkYellow
5961
continue
6062
}
6163
}

‎Project_Move-ChildItemUp/Helpers/PScmdWrapper/Resolve-PathwErr.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function Resolve-PathwErr {
4141
try {
4242
$outputPath = (Resolve-Path -Path $inputFolderPath -ErrorAction Stop).Path
4343
Write-Verbose "Resolve operation successful for '$inputFolderPath',"
44-
Write-Verbose "output path: '$outputPath'.`n"
44+
Write-Verbose "Output path: '$outputPath'."
4545
}
4646
catch {
4747
$outputPath = $null

‎Project_Move-ChildItemUp/Helpers/ValidationHelper/Confirm-FolderArray.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ function Confirm-FolderArray {
1818
contains only unique entries.
1919
2020
.INPUTS
21-
[string[]] Accepts an array of folder paths as input.
21+
[System.Collections.Generic.List[string]]
22+
Accepts an array of folder paths as input.
2223
2324
.OUTPUTS
2425
None. This function does not return output objects, but may write warning or verbose messages
@@ -40,13 +41,15 @@ function Confirm-FolderArray {
4041
)
4142

4243
# Checking input folder array for null
44+
Write-Verbose "Checking for null or empty input..."
4345
if (-not $folderPathsArray -or $folderPathsArray.Count -eq 0) {
4446
Show-ErrorMsg `
4547
-FunctionName $MyInvocation.MyCommand.Name
4648
-CustomMessage "No folders provided."
4749
}
4850

4951
# Checking for duplication in a simple manner through counting
52+
Write-Verbose "Checking for duplicate items..."
5053
if ($folderPathsArray.Count -ne ($folderPathsArray | Select-Object -Unique).Count) {
5154
# Current behavior, function continues and warns user about the skipping
5255
Write-Warning "Duplicate folders detected in the input."

‎Project_Move-ChildItemUp/Move-ChildItemUp.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,17 @@ function Move-ChildItemUp {
6767

6868
# After collecting all pipeline input, process the array
6969
end {
70-
Write-Host "Program starts..." -ForegroundColor Green
70+
Write-Host "Program starts...`n" `
71+
-ForegroundColor Green
7172

7273
# Step 1:
7374
# Validate input array only, not the path
75+
Write-Verbose "Start input folder array check..."
7476
Confirm-FolderArray $folderPathsArray
7577

7678
# Step 2:
7779
# Assemble the folder object array for ease of process
80+
Write-Verbose "Start collecting folder relevant info..."
7881
[System.Collections.Generic.List[pscustomobject]]$folderObjArray =
7982
Get-FolderInfo $folderPathsArray
8083

@@ -86,6 +89,7 @@ function Move-ChildItemUp {
8689
# Remove-Item -Path $source -Recurse -Force
8790
Remove-EmptyFolder $folderObjArray
8891

89-
Write-Host "Program complete." -ForegroundColor Green
92+
Write-Host "`nAction complete." `
93+
-ForegroundColor Green
9094
}
9195
}

‎Project_Move-ChildItemUp/Tests/test4.txt

Whitespace-only changes.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /