mirror of
https://github.com/Baipyrus/dotfiles.git
synced 2024-12-26 11:21:46 +00:00
rename function parameter for naming consistency
This commit is contained in:
parent
ad9ffc0a19
commit
5090a04e95
@ -15,7 +15,7 @@ ReadyDotfilesRepo -cwd $currentDir -url $repoUrl -destination $dotfilesRepo
|
|||||||
|
|
||||||
# Setting up Alacritty Configuration
|
# Setting up Alacritty Configuration
|
||||||
Write-Host "Setting up Alacritty configuration..." -ForegroundColor Cyan
|
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
|
# Copy the main Alacritty configuration file
|
||||||
CopyFileWithPrompt "$dotfilesRepo\alacritty\alacritty.toml" "$alacrittyConfigDir\alacritty.toml"
|
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
|
Write-Host "Setting up Neovim configuration..." -ForegroundColor Cyan
|
||||||
$ubuntu = wsl.exe -l --all | Where-Object { $_.Replace("`0", "") -match '^Ubuntu' }
|
$ubuntu = wsl.exe -l --all | Where-Object { $_.Replace("`0", "") -match '^Ubuntu' }
|
||||||
if ($null -eq $ubuntu)
|
if ($null -eq $ubuntu)
|
||||||
{ ProcessUrlFiles -sourceDir "$dotfilesRepo\nvim" -destinationDir "$env:LOCALAPPDATA"
|
{ ProcessUrlFiles -source "$dotfilesRepo\nvim" -destination "$env:LOCALAPPDATA"
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
# TODO: Expand into generic WSL setup while installing required dev tools
|
# TODO: Expand into generic WSL setup while installing required dev tools
|
||||||
@ -47,7 +47,7 @@ Write-Host "============================================" -ForegroundColor DarkG
|
|||||||
|
|
||||||
# Installing Nerd Fonts
|
# Installing Nerd Fonts
|
||||||
Write-Host "Installing Nerd Fonts..." -ForegroundColor Cyan
|
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"
|
UnzipAndInstall -source "$dotfilesRepo\nerd-fonts"
|
||||||
|
|
||||||
# Final message
|
# Final message
|
||||||
|
@ -76,20 +76,20 @@ function CopyFileWithPrompt
|
|||||||
function ProcessUrlFiles
|
function ProcessUrlFiles
|
||||||
{
|
{
|
||||||
param (
|
param (
|
||||||
[string]$sourceDir,
|
[string]$source,
|
||||||
[Parameter(Mandatory=$false)][string]$destinationDir,
|
[Parameter(Mandatory=$false)][string]$destination,
|
||||||
[Parameter(Mandatory=$false)][string]$fileExt
|
[Parameter(Mandatory=$false)][string]$fileExt
|
||||||
)
|
)
|
||||||
|
|
||||||
# Ensure the destination directory exists
|
# 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
|
Write-Host "Creating destination directory $destination..." -ForegroundColor Cyan
|
||||||
New-Item -ItemType Directory -Path $destinationDir | Out-Null
|
New-Item -ItemType Directory -Path $destination | Out-Null
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create temporary directory for curl
|
# Create temporary directory for curl
|
||||||
$appname = $sourceDir.Split('\')[-1]
|
$appname = $source.Split('\')[-1]
|
||||||
$tmpApp = "$env:TMP\$appname-config"
|
$tmpApp = "$env:TMP\$appname-config"
|
||||||
if (-not (Test-Path $tmpApp))
|
if (-not (Test-Path $tmpApp))
|
||||||
{ New-Item -ItemType Directory -Path $tmpApp | Out-Null
|
{ New-Item -ItemType Directory -Path $tmpApp | Out-Null
|
||||||
@ -97,13 +97,13 @@ function ProcessUrlFiles
|
|||||||
Set-Location $tmpApp
|
Set-Location $tmpApp
|
||||||
|
|
||||||
# Find all .url files in the source directory
|
# 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)
|
foreach ($file in $urlFiles)
|
||||||
{
|
{
|
||||||
$url = Get-Content $file.FullName
|
$url = Get-Content $file.FullName
|
||||||
$fileName = [System.IO.Path]::GetFileNameWithoutExtension($file.Name)
|
$fileName = [System.IO.Path]::GetFileNameWithoutExtension($file.Name)
|
||||||
$destinationPath = "$destinationDir\$fileName"
|
$destinationPath = "$destination\$fileName"
|
||||||
|
|
||||||
if (-not ($url -match 'git@|https://.*\.git'))
|
if (-not ($url -match 'git@|https://.*\.git'))
|
||||||
{
|
{
|
||||||
@ -115,11 +115,11 @@ function ProcessUrlFiles
|
|||||||
$extension = $fileExt
|
$extension = $fileExt
|
||||||
$url += $fileExt
|
$url += $fileExt
|
||||||
}
|
}
|
||||||
$destinationPath = "$destinationDir\$fileName$extension"
|
$destinationPath = "$destination\$fileName$extension"
|
||||||
|
|
||||||
# Respond only if destination is provided
|
# Respond only if destination is provided
|
||||||
$conditional = " to $destinationPath"
|
$conditional = " to $destinationPath"
|
||||||
if (-not $destinationDir)
|
if (-not $destination)
|
||||||
{ $conditional = ''
|
{ $conditional = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,14 +128,14 @@ function ProcessUrlFiles
|
|||||||
$tmpDestination = "$tmpApp\$fileName$extension"
|
$tmpDestination = "$tmpApp\$fileName$extension"
|
||||||
|
|
||||||
# Copy only if destination is provided
|
# Copy only if destination is provided
|
||||||
if ($destinationDir)
|
if ($destination)
|
||||||
{ CopyFileWithPrompt $tmpDestination $destinationPath
|
{ CopyFileWithPrompt $tmpDestination $destinationPath
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
# Use $tmpApp as destination in case of git repo
|
# Use $tmpApp as destination in case of git repo
|
||||||
if (-not $destinationDir)
|
if (-not $destination)
|
||||||
{ $destinationPath = "$tmpApp\$fileName"
|
{ $destinationPath = "$tmpApp\$fileName"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user