|
1 | 1 |
|
2 | 2 | <#PSScriptInfo
|
3 | 3 |
|
4 |
| -.VERSION 1.0.3 |
| 4 | +.VERSION 1.1.0 |
5 | 5 |
|
6 | 6 | .GUID ccb5be4c-ea07-4c45-a5b4-6310df24e2bc
|
7 | 7 |
|
@@ -284,6 +284,23 @@ function Write-LockFile {
|
284 | 284 | }
|
285 | 285 | }
|
286 | 286 |
|
| 287 | +function New-SymbolicLinks { |
| 288 | + param ( |
| 289 | + [string]$Source, |
| 290 | + [string]$Destination, |
| 291 | + [switch]$Recurse |
| 292 | + ) |
| 293 | + |
| 294 | + Get-ChildItem $Source -Recurse:$Recurse | Where-Object { !$_.PSIsContainer } | ForEach-Object { |
| 295 | + $destinationPath = $_.FullName -replace [regex]::Escape($Source), $Destination |
| 296 | + if (!(Test-Path (Split-Path $destinationPath))) { |
| 297 | + New-Item (Split-Path $destinationPath) -ItemType Directory -Force -ErrorAction SilentlyContinue | Out-Null |
| 298 | + } |
| 299 | + New-Item -ItemType SymbolicLink -Path $destinationPath -Target $($_.FullName) -Force -ErrorAction SilentlyContinue | Out-Null |
| 300 | + Write-ColorText "{Blue}[symlink] {Green}$($_.FullName) {Yellow}--> {Gray}$destinationPath" |
| 301 | + } |
| 302 | +} |
| 303 | + |
287 | 304 | ########################################################################
|
288 | 305 | ### MAIN SCRIPT ###
|
289 | 306 | ########################################################################
|
@@ -602,42 +619,9 @@ if (Get-Command gh -ErrorAction SilentlyContinue) {
|
602 | 619 | ####################################################################
|
603 | 620 | # symlinks
|
604 | 621 | Write-TitleBox -Title "Add symbolic links for dotfiles"
|
605 |
| -$symlinks = @{ |
606 |
| - $PROFILE.CurrentUserAllHosts = ".\Profile.ps1" |
607 |
| - "$Env:APPDATA\bat" = ".\config\bat" |
608 |
| - "$Env:APPDATA\Code\User\keybindings.json" = ".\vscode\keybindings.json" |
609 |
| - "$Env:APPDATA\Code\User\settings.json" = ".\vscode\settings.json" |
610 |
| - "$Env:LOCALAPPDATA\fastfetch" = ".\config\fastfetch" |
611 |
| - "$Env:LOCALAPPDATA\lazygit" = ".\config\lazygit" |
612 |
| - "$Env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" = ".\windows\settings.json" |
613 |
| - "$HOME\.bash_profile" = ".\home\.bash_profile" |
614 |
| - "$HOME\.bashrc" = ".\home\.bashrc" |
615 |
| - "$HOME\.config\bash" = ".\config\bash" |
616 |
| - "$HOME\.config\delta" = ".\config\delta" |
617 |
| - "$HOME\.config\eza" = ".\config\eza" |
618 |
| - "$HOME\.config\gh-dash" = ".\config\gh-dash" |
619 |
| - "$HOME\.config\gitaliases" = ".\config\gitaliases" |
620 |
| - "$HOME\.config\komorebi" = ".\config\komorebi" |
621 |
| - "$HOME\.config\mise" = ".\config\mise" |
622 |
| - "$HOME\.config\spotify-tui" = ".\config\spotify-tui" |
623 |
| - "$HOME\.config\starship.toml" = ".\config\starship.toml" |
624 |
| - "$HOME\.config\whkdrc" = ".\config\whkdrc" |
625 |
| - "$HOME\.config\yasb" = ".\config\yasb" |
626 |
| - "$HOME\.config\yazi" = ".\config\yazi" |
627 |
| - "$HOME\.czrc" = ".\home\.czrc" |
628 |
| - "$HOME\.gitconfig" = ".\home\.gitconfig" |
629 |
| - "$HOME\.inputrc" = ".\home\.inputrc" |
630 |
| - "$HOME\.npmrc" = ".\home\.npmrc" |
631 |
| - "$HOME\.wslconfig" = ".\home\.wslconfig" |
632 |
| -} |
633 |
| - |
634 |
| -# add symlinks |
635 |
| -foreach ($symlink in $symlinks.GetEnumerator()) { |
636 |
| - Write-Verbose -Message "Creating symlink for $(Resolve-Path $symlink.Value) --> $($symlink.Key)" |
637 |
| - Get-Item -Path $symlink.Key -ErrorAction SilentlyContinue | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue |
638 |
| - New-Item -ItemType SymbolicLink -Path $symlink.Key -Target (Resolve-Path $symlink.Value) -Force | Out-Null |
639 |
| - Write-ColorText "{Blue}[symlink] {Green}$(Resolve-Path $symlink.Value) {Yellow}--> {Gray}$($symlink.Key)" |
640 |
| -} |
| 622 | +New-SymbolicLinks -Source "$PSScriptRoot\config\home" -Destination "$env:USERPROFILE" -Recurse |
| 623 | +New-SymbolicLinks -Source "$PSScriptRoot\config\AppData" -Destination "$env:USERPROFILE\AppData" -Recurse |
| 624 | +New-SymbolicLinks -Source "$PSScriptRoot\config\config" -Destination "$env:USERPROFILE\.config" -Recurse |
641 | 625 | Refresh ($i++)
|
642 | 626 |
|
643 | 627 | # Set the right git name and email for the user after symlinking
|
@@ -745,7 +729,7 @@ Refresh ($i++)
|
745 | 729 | # VSCode Extensions
|
746 | 730 | if (Get-Command code -ErrorAction SilentlyContinue) {
|
747 | 731 | Write-TitleBox -Title "VSCode Extensions Installation"
|
748 |
| - $extensionList = Get-Content "$PSScriptRoot\vscode\extensions.list" |
| 732 | + $extensionList = Get-Content "$PSScriptRoot\extensions.list" |
749 | 733 | foreach ($ext in $extensionList) {
|
750 | 734 | if (!(code --list-extensions | Select-String "$ext")) {
|
751 | 735 | Write-Verbose -Message "Installing VSCode Extension: $ext"
|
|
0 commit comments