Skip to content

Instantly share code, notes, and snippets.

@SQLDBAWithABeard
Last active July 2, 2024 08:32
Show Gist options
  • Save SQLDBAWithABeard/13e1f7bf3dd69afc3496e00f6d945b49 to your computer and use it in GitHub Desktop.
Save SQLDBAWithABeard/13e1f7bf3dd69afc3496e00f6d945b49 to your computer and use it in GitHub Desktop.
ProfileForContainers
function Load-Profile {
$env:POSH_THEMES_PATH = (Get-ChildItem /workspaces/* -Recurse -Directory|Where-Object Name -eq themes)[0].FullName
function global:Set-PoshPrompt {
param(
$theme
)
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\$theme.omp.json" | Invoke-Expression
}
# Create scriptblock that collects information and name it
Register-PSFTeppScriptblock -Name "poshthemes" -ScriptBlock { Get-ChildItem $env:POSH_THEMES_PATH | Select-Object -ExpandProperty Name -Unique | ForEach-Object { $_ -replace '\.omp\.json$', '' } }
#Assign scriptblock to function
Register-PSFTeppArgumentCompleter -Command Set-PoshPrompt -Parameter theme -Name poshthemes
$themes = @(
'neko',
'sonicboom_dark',
'neko',
'easy-term',
'if_tea',
'neko',
'kushal'
'nigfht-owl',
'neko',
'powerlevel10k_rainbow',
'quick-term',
'neko',
'stelbent.minimal',
'tokyo',
'neko',
'unicorn',
'wholespace',
'sonicboom_dark',
'lambdageneration'
)
$global:__currentTheme = (Get-Random -InputObject $themes)
function global:Get-CurrentPoshTheme { $__currentTheme }
Set-PoshPrompt -Theme $__currentTheme
if ($psstyle) {
$psstyle.FileInfo.Directory = $psstyle.FileInfo.Executable = $psstyle.FileInfo.SymbolicLink = ""
$PSStyle.FileInfo.Extension.Clear()
$PSStyle.Formatting.TableHeader = ""
$PsStyle.Formatting.FormatAccent = ""
}
}
"Load-Profile for full profile"
function prompt {
#Load-Profile
"PS > "
}
function whatsmyip {
[CmdletBinding()]
param (
[Parameter()]
[switch]
$clip
)
if ($clip) {
(Invoke-WebRequest -Uri "http://ifconfig.me/ip").Content | Set-Clipboard
} else {
(Invoke-WebRequest -Uri "http://ifconfig.me/ip").Content
}
}
Import-Module /workspaces/PSConfEU_2024_DevContainers/Events.psm1
@SQLDBAWithABeard
Copy link
Author

$env:POSH_THEMES_PATH = '{0}\Programs\oh-my-posh\themes' -f $env:LOCALAPPDATA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment