From 5090a04e95b104b30a2c70f47659ebaa169d5e49 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Sun, 24 Nov 2024 21:12:23 +0100 Subject: [PATCH] rename function parameter for naming consistency --- install_windows.ps1 | 6 +++--- util/windows.psm1 | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/install_windows.ps1 b/install_windows.ps1 index 68aefa4..3ec15c7 100644 --- a/install_windows.ps1 +++ b/install_windows.ps1 @@ -15,7 +15,7 @@ ReadyDotfilesRepo -cwd $currentDir -url $repoUrl -destination $dotfilesRepo # Setting up Alacritty Configuration Write-Host "Setting up Alacritty configuration..." -ForegroundColor Cyan -ProcessUrlFiles -sourceDir "$dotfilesRepo\alacritty" -destinationDir $alacrittyConfigDir +ProcessUrlFiles -source "$dotfilesRepo\alacritty" -destination $alacrittyConfigDir # Copy the main Alacritty configuration file CopyFileWithPrompt "$dotfilesRepo\alacritty\alacritty.toml" "$alacrittyConfigDir\alacritty.toml" @@ -24,7 +24,7 @@ CopyFileWithPrompt "$dotfilesRepo\alacritty\alacritty.toml" "$alacrittyConfigDir Write-Host "Setting up Neovim configuration..." -ForegroundColor Cyan $ubuntu = wsl.exe -l --all | Where-Object { $_.Replace("`0", "") -match '^Ubuntu' } if ($null -eq $ubuntu) -{ ProcessUrlFiles -sourceDir "$dotfilesRepo\nvim" -destinationDir "$env:LOCALAPPDATA" +{ ProcessUrlFiles -source "$dotfilesRepo\nvim" -destination "$env:LOCALAPPDATA" } else { # TODO: Expand into generic WSL setup while installing required dev tools @@ -47,7 +47,7 @@ Write-Host "============================================" -ForegroundColor DarkG # Installing Nerd Fonts Write-Host "Installing Nerd Fonts..." -ForegroundColor Cyan -ProcessUrlFiles -sourceDir "$dotfilesRepo\nerd-fonts" -fileExt ".zip" +ProcessUrlFiles -source "$dotfilesRepo\nerd-fonts" -fileExt ".zip" UnzipAndInstall -source "$dotfilesRepo\nerd-fonts" # Final message diff --git a/util/windows.psm1 b/util/windows.psm1 index 3dff204..197c89e 100644 --- a/util/windows.psm1 +++ b/util/windows.psm1 @@ -76,20 +76,20 @@ function CopyFileWithPrompt function ProcessUrlFiles { param ( - [string]$sourceDir, - [Parameter(Mandatory=$false)][string]$destinationDir, + [string]$source, + [Parameter(Mandatory=$false)][string]$destination, [Parameter(Mandatory=$false)][string]$fileExt ) # Ensure the destination directory exists - if ($destinationDir -and (-not (Test-Path $destinationDir))) + if ($destination -and (-not (Test-Path $destination))) { - Write-Host "Creating destination directory $destinationDir..." -ForegroundColor Cyan - New-Item -ItemType Directory -Path $destinationDir | Out-Null + Write-Host "Creating destination directory $destination..." -ForegroundColor Cyan + New-Item -ItemType Directory -Path $destination | Out-Null } # Create temporary directory for curl - $appname = $sourceDir.Split('\')[-1] + $appname = $source.Split('\')[-1] $tmpApp = "$env:TMP\$appname-config" if (-not (Test-Path $tmpApp)) { New-Item -ItemType Directory -Path $tmpApp | Out-Null @@ -97,13 +97,13 @@ function ProcessUrlFiles Set-Location $tmpApp # Find all .url files in the source directory - $urlFiles = Get-ChildItem -Path $sourceDir -Filter '*.url' + $urlFiles = Get-ChildItem -Path $source -Filter '*.url' foreach ($file in $urlFiles) { $url = Get-Content $file.FullName $fileName = [System.IO.Path]::GetFileNameWithoutExtension($file.Name) - $destinationPath = "$destinationDir\$fileName" + $destinationPath = "$destination\$fileName" if (-not ($url -match 'git@|https://.*\.git')) { @@ -115,11 +115,11 @@ function ProcessUrlFiles $extension = $fileExt $url += $fileExt } - $destinationPath = "$destinationDir\$fileName$extension" + $destinationPath = "$destination\$fileName$extension" # Respond only if destination is provided $conditional = " to $destinationPath" - if (-not $destinationDir) + if (-not $destination) { $conditional = '' } @@ -128,14 +128,14 @@ function ProcessUrlFiles $tmpDestination = "$tmpApp\$fileName$extension" # Copy only if destination is provided - if ($destinationDir) + if ($destination) { CopyFileWithPrompt $tmpDestination $destinationPath } continue } # Use $tmpApp as destination in case of git repo - if (-not $destinationDir) + if (-not $destination) { $destinationPath = "$tmpApp\$fileName" }