2 # . C:\src\dotfiles\Microsoft.PowerShell_profile.ps1
5 # Get-ChildItem -Path 'C:\Repos' -Filter "*.psd1" -Recurse | ForEach-Object -Process {
6 # $Path = Split-Path -Path $_.Directory -Parent
7 # $env:PSModulePath = $env:PSModulePath + ";$($Path)"
9 # $env:PSModulePath = $env:PSModulePath.Replace("\\ad.uillinois.edu\techsvc\home\$($ENV:USERNAME)\Documents\PowerShell\Modules;",'')
11 # No longer needed in PowerShell 7
13 # Bootstrap for older PowerShell
14 Write-Host "***Bootstrapped Is Windows for older PowerShell***"
15 $IsWindows = ($env:OS -eq "Windows_NT")
20 Write-Host "***Is Windows***"
25 # Some Paths that are annoying to find/restore if the installer fails
26 $ENV:PATH+=";C:\Program Files\Microsoft VS Code\bin" # One Editor to rule them all
27 $ENV:PATH+=";C:\Program Files\Git\cmd" # Version control is nice.
28 $ENV:PATH+=";C:\ProgramData\chocolatey\bin" # Package management is nice.
29 $ENV:PATH+=";C:\bin\x16emu" # Package management is nice.
30 $ENV:PATH+=";C:\Program Files (x86)\GnuWin32\bin" # GNU Utils - i.e. rm
31 $ENV:PATH+=";C:\PENGUIN" # Flag to ensure my profile kicked in.
34 $ENV:PATH+=":$HOME/x16/x16-emulator" # x16 Emulator
35 $ENV:PATH+=":$HOME/src/x16-demo/tools" # x16 python tools
37 # alias renumber $HOME/src/x16-demo/
39 $env:Journal = "~\Journal\2021" # allows cd $env:journal
40 $env:minion = "$env:src\minion"
42 # Import some home grown PowerShell modules, if they are installed.
44 $modPaths = Get-Childitem -Path "$env:src\dotfiles\psmodules"
45 $modPaths += Get-Childitem -Path "$env:minion\psmodule"
47 # https://github.com/uillinois-community/powershell-scripts
48 $modPaths += Get-Childitem -Path "$env:src\powershell-scripts\modules"
50 # Windows Only Modules
52 $modPaths += Get-Childitem -Path "$env:src\dotfiles\win_psmodules"
54 if($modPaths.length -eq 0){
55 Write-Host "No modules found."
57 $modPaths | ForEach-Object {
58 $fileName = $_.FullName
59 if($filename -Like "*.psm1") {
60 Import-Module $fileName
61 Write-Host ">> Loaded $fileName"
67 # Linux-like up/down in shell
68 Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
69 Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward
70 Set-PSReadlineOption -HistorySavePath $env:src\PSHistory.log
72 # Minion alias commands - 'today'
73 # . C:\src\minion\profiles\alias.ps1
74 . $env:minion\profiles\alias.ps1
75 # Add Minion go executable to path.
76 . $env:minion\profiles\path.ps1
78 Write-Host "+ Added minion command to path."
80 $ENV:PATH+=";$env:minion\go" # Flag to ensure my profile kicked in.
84 New-Alias which get-command
86 # Delay loading PoshGit for speed.
87 function Enable-PoshGit {
88 Import-Module posh-git
90 New-Alias pg Enable-PoshGit
91 Write-Host "+ Type 'pg' to enable PoshGit"
93 function Invoke-X16Emu {
97 x16emu.exe -bas $File -keymap en-us
100 New-Alias x16 Invoke-X16Emu
102 if((Get-Location).Path -eq $HOME){
106 function Get-GitLog() {
110 function Get-GitStatus() {
111 git status -b --short
114 # Tell my scripts which GitHub repositories to look in.
115 $env:GITHUB_USERNAME = 'edthedev'
116 $env:GITHUB_ORG = 'techservicesillinois'
117 $env:GITHUB_REPOS = @('SecOps-Tools', 'secdev-job-aids',
118 'awscli-login', 'farmit')
121 New-Alias ol Get-GitLog
122 New-Alias st Get-GitStatus
125 New-Alias dash Get-MyDashboard # from dash.psm1
126 New-Alias agenda Get-JournalAgenda # from minion_go.psm1