From 12d828c75e9cefd2ecf95dda328f8aa862273935 Mon Sep 17 00:00:00 2001 From: TheFlyingFool Date: Tue, 14 May 2024 15:06:11 -0500 Subject: [PATCH] Setup Profile Started --- CopyFromFile.txt | 9 +++++++++ README.md | 12 +++++++++++- setup.ps1 | 34 ++++++++++++++++++++++++++++++++-- 3 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 CopyFromFile.txt diff --git a/CopyFromFile.txt b/CopyFromFile.txt new file mode 100644 index 0000000..c5ab2df --- /dev/null +++ b/CopyFromFile.txt @@ -0,0 +1,9 @@ +Register-ArgumentCompleter -Native -CommandName winget -ScriptBlock { + param($wordToComplete, $commandAst, $cursorPosition) + [Console]::InputEncoding = [Console]::OutputEncoding = $OutputEncoding = [System.Text.Utf8Encoding]::new() + $Local:word = $wordToComplete.Replace('"', '""') + $Local:ast = $commandAst.ToString().Replace('"', '""') + winget complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object { + [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) + } + } \ No newline at end of file diff --git a/README.md b/README.md index eb9cbbf..f16eb53 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ ## About "Project" ## -Little PowerShell script that installs most of the windows programs I use +Little PowerShell script that installs most of the windows programs I use. +Working on getting it to setup more of the env as well based on: @@ -10,6 +11,10 @@ based on: * * +Shoutout to: +[ankokudaishogun](https://www.reddit.com/user/ankokudaishogun/) for being a +HUGE help + ## Usage ## ### FIRST ### @@ -23,3 +28,8 @@ PowerShell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System. ``` You'll get 5 menu options. Use the ones that make sense. + +## Planned Features ## + +Install NFS Client features +Map my typical network driver? diff --git a/setup.ps1 b/setup.ps1 index 3468774..ecb2ce9 100644 --- a/setup.ps1 +++ b/setup.ps1 @@ -31,6 +31,8 @@ $settingsJson = @{installBehavior = @{ } $settingsJson | ConvertTo-Json | Out-File $settingsPath -Encoding utf8 + + function InstallTheApps() { Foreach ($app in $apps) { $listApp = winget list --exact -q $app.name @@ -52,6 +54,31 @@ function InstallTheApps() { } +function Update-Profile { + if (-not (Test-Path $PROFILE)) { $null = New-Item -Force $PROFILE } + if (-not (Test-Path ./CopyFromFile.txt)) {iex ((New-Object System.Net.WebClient).DownloadString('https://git.theflyingfool.com/theflyingfool/Win_Setup/raw/branch/main/CopyFromFile.txt'))} +# Get-Content -Path $PROFILE + Get-Content -Path .\CopyFromFile.txt | Add-Content -Path $PROFILE +# Get-Content -Path $PROFILE + +#> + <# + Write-Output ' + + Register-ArgumentCompleter -Native -CommandName winget -ScriptBlock { + param($wordToComplete, $commandAst, $cursorPosition) + [Console]::InputEncoding = [Console]::OutputEncoding = $OutputEncoding = [System.Text.Utf8Encoding]::new() + $Local:word = $wordToComplete.Replace('"', '""') + $Local:ast = $commandAst.ToString().Replace('"', '""') + winget complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object { + [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) + } + } + }' >> $PROFILE + +#> + } + do { $answer = $null do { @@ -79,7 +106,7 @@ do { switch ( $answer ) { - "1" { $apps = @( # BASE APPS + "1" { $apps = @( # BASE APPS @{name = 'Microsoft.PowerShell' }, @{name = 'Microsoft.VisualStudioCode' }, @{name = 'Microsoft.WindowsTerminal'}, @@ -102,7 +129,10 @@ do { @{name = 'Microsoft.Office' }, @{name = 'Malwarebytes.Malwarebytes '} ) - InstallTheApps $Apps + + InstallTheApps $Apps + Update-Profile + } "2" { $apps = @( # Game Launchers