Skip to content

Commit

Permalink
🚨 fix: warnings with Write-Host and Write-Information
Browse files Browse the repository at this point in the history
- Replaced `Write-Information` cmdlet to `Write-Host` cmdlet to resolve
  the compatibility issue with older versions of Powershell
- Fixed the warning with `Write-Host` by using the `-f` format operator
  to concatenate the string and the variable

These changes improve the performance and readability of the script.
  • Loading branch information
chriskyfung committed Jan 30, 2024
1 parent a8f5a4d commit b8048d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions theBrain/Resize-TheBrainNotesYouTubeThumbnail.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Write-Host 'Scanning YouTube thumbnail URLs in Brain Notes...'
$MatchInfo = Get-ChildItem -Path $SubFolders -Filter $Filename -Recurse | Select-String '\/(hq|maxres)default.jpg\)' -List

# For each matching result
Write-Information 'Backing up and modifying Brain Notes...'
Write-Host 'Backing up and modifying Brain Notes...'
ForEach ($Match in $MatchInfo) {
$FilePath = $Match.Path | Convert-Path # FilePath of the Notes.md file
$ParentFolder = Split-Path -Path $FilePath -Parent # Path of the parent folder
Expand All @@ -62,7 +62,7 @@ ForEach ($Match in $MatchInfo) {
Write-Verbose "Modified --> '$FilePath'"
}

Write-Host 'Finished: ' $MatchInfo.Length 'file(s) found' # Output the number of files found
Write-Host ('Finished: {0} file(s) found' -f $MatchInfo.Length) # Output the number of files found

$MatchInfo | Format-Table Path | Out-Host # Output the path of the files found

Expand Down

0 comments on commit b8048d7

Please sign in to comment.