Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Commit

Permalink
Allow overriding the current user
Browse files Browse the repository at this point in the history
Resolves #163
  • Loading branch information
JanDeDobbeleer committed Nov 2, 2019
1 parent 02374b1 commit e8eed6c
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 34 deletions.
4 changes: 2 additions & 2 deletions Themes/Agnoster.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function Write-Theme {
$prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol) " -ForegroundColor $sl.Colors.AdminIconForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor
}

$user = [System.Environment]::UserName
$user = $sl.CurrentUser
$computer = [System.Environment]::MachineName
if (Test-NotDefaultUser($user)) {
$prompt += Write-Prompt -Object "$user@$computer " -ForegroundColor $sl.Colors.SessionInfoForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor
Expand Down Expand Up @@ -71,4 +71,4 @@ $sl.Colors.GitForegroundColor = [ConsoleColor]::Black
$sl.Colors.WithForegroundColor = [ConsoleColor]::White
$sl.Colors.WithBackgroundColor = [ConsoleColor]::DarkRed
$sl.Colors.VirtualEnvBackgroundColor = [System.ConsoleColor]::Red
$sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::White
$sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::White
4 changes: 2 additions & 2 deletions Themes/Darkblood.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function Write-Theme {
)

$prompt = Write-Prompt -Object ([char]::ConvertFromUtf32(0x250C)) -ForegroundColor $sl.Colors.PromptSymbolColor
$user = [System.Environment]::UserName
$user = $sl.CurrentUser
$prompt += Write-Segment -content $user -foregroundColor $sl.Colors.PromptForegroundColor

# $prompt += "$($sl.PromptSymbols.SegmentForwardSymbol) "
Expand Down Expand Up @@ -82,4 +82,4 @@ $sl.Colors.GitForegroundColor = [ConsoleColor]::White
$sl.Colors.WithForegroundColor = [ConsoleColor]::DarkYellow
$sl.Colors.WithBackgroundColor = [ConsoleColor]::Magenta
$sl.Colors.VirtualEnvBackgroundColor = [System.ConsoleColor]::Magenta
$sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::White
$sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::White
2 changes: 1 addition & 1 deletion Themes/Fish.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function Write-Theme {
$prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol) " -ForegroundColor $sl.Colors.AdminIconForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor
}

$user = [System.Environment]::UserName
$user = $sl.CurrentUser
$computer = [System.Environment]::MachineName
$path = Get-FullPath -dir $pwd
if (Test-NotDefaultUser($user)) {
Expand Down
2 changes: 1 addition & 1 deletion Themes/Honukai.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function Write-Theme {
# write # and space
$prompt = Write-Prompt -Object $sl.PromptSymbols.StartSymbol -ForegroundColor $sl.Colors.PromptHighlightColor
# write user
$user = [System.Environment]::UserName
$user = $sl.CurrentUser
if (Test-NotDefaultUser($user)) {
$prompt += Write-Prompt -Object " $user" -ForegroundColor $sl.Colors.PromptHighlightColor
# write at (devicename)
Expand Down
2 changes: 1 addition & 1 deletion Themes/Paradox.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function Write-Theme {
$prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol) " -ForegroundColor $sl.Colors.AdminIconForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor
}

$user = [System.Environment]::UserName
$user = $sl.CurrentUser
$computer = [System.Environment]::MachineName
$path = Get-FullPath -dir $pwd
if (Test-NotDefaultUser($user)) {
Expand Down
6 changes: 3 additions & 3 deletions Themes/PowerLine.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function Write-Theme {
$prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol) " -ForegroundColor $sl.Colors.AdminIconForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor
}

$user = [System.Environment]::UserName
$user = $sl.CurrentUser
$computer = [System.Environment]::MachineName
if (Test-NotDefaultUser($user)) {
$prompt += Write-Prompt -Object "$user@$computer " -ForegroundColor $sl.Colors.SessionInfoForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor
Expand All @@ -41,7 +41,7 @@ function Write-Theme {
# Writes the drive portion
$path = (Get-FullPath -dir $pwd).Replace('\', ' ' + [char]::ConvertFromUtf32(0xE0B1) + ' ') + ' '
$prompt += Write-Prompt -Object $path -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor

$status = Get-VCSStatus
if ($status) {
$themeInfo = Get-VcsInfo -status ($status)
Expand Down Expand Up @@ -72,4 +72,4 @@ $sl.Colors.GitForegroundColor = [ConsoleColor]::DarkGray
$sl.Colors.WithForegroundColor = [ConsoleColor]::White
$sl.Colors.WithBackgroundColor = [ConsoleColor]::DarkRed
$sl.Colors.VirtualEnvBackgroundColor = [System.ConsoleColor]::Red
$sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::White
$sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::White
2 changes: 1 addition & 1 deletion Themes/Sorin.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function Write-Theme {
$prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol) " -ForegroundColor $sl.Colors.AdminIconForegroundColor
}

$user = [System.Environment]::UserName
$user = $sl.CurrentUser
if (Test-NotDefaultUser($user)) {
$prompt += Write-Prompt -Object "$user " -ForegroundColor $sl.Colors.PromptForegroundColor
}
Expand Down
4 changes: 2 additions & 2 deletions Themes/tehrob.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function Write-Theme
$with
)

$user = [System.Environment]::UserName
$user = $s1.CurrentUser
$prompt = Write-Prompt -Object "$user " -ForegroundColor $s1.Colors.PromptForegroundColor
$prompt += Write-Prompt -Object ":: " -ForegroundColor $s1.Colors.AdminIconForegroundColor
$prompt += Write-Prompt -Object "$(Get-FullPath -dir $pwd) " -ForegroundColor $s1.Colors.DriveForegroundColor
Expand Down Expand Up @@ -38,4 +38,4 @@ $s1.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x00BB)
# Colors
$s1.Colors.PromptForegroundColor = [ConsoleColor]::White
$s1.Colors.AdminIconForegroundColor = [ConsoleColor]::Blue
$s1.Colors.DriveForegroundColor = [ConsoleColor]::Green
$s1.Colors.DriveForegroundColor = [ConsoleColor]::Green
43 changes: 22 additions & 21 deletions defaults.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Oh-My-Posh default settings
$global:ThemeSettings = New-Object -TypeName PSObject -Property @{
CurrentThemeLocation = "$PSScriptRoot\Themes\Agnoster.psm1"
MyThemesLocation = (Join-Path (Split-Path -Parent $PROFILE) "PoshThemes")
ErrorCount = 0
GitSymbols = @{
CurrentUser = [System.Environment]::UserName
CurrentThemeLocation = "$PSScriptRoot\Themes\Agnoster.psm1"
MyThemesLocation = (Join-Path (Split-Path -Parent $PROFILE) "PoshThemes")
ErrorCount = 0
GitSymbols = @{
BranchSymbol = [char]::ConvertFromUtf32(0xE0A0)
BeforeStashSymbol = '{'
BeforeIndexSymbol = ''
Expand All @@ -17,25 +18,25 @@ $global:ThemeSettings = New-Object -TypeName PSObject -Property @{
BranchIdenticalStatusToSymbol = [char]::ConvertFromUtf32(0x2263)
BranchAheadStatusSymbol = [char]::ConvertFromUtf32(0x2191)
BranchBehindStatusSymbol = [char]::ConvertFromUtf32(0x2193)
OriginSymbols = @{
Enabled = $false
Github = [char]::ConvertFromUtf32(0xF09B)
Bitbucket = [char]::ConvertFromUtf32(0xF171)
GitLab = [char]::ConvertFromUtf32(0xF296)
OriginSymbols = @{
Enabled = $false
Github = [char]::ConvertFromUtf32(0xF09B)
Bitbucket = [char]::ConvertFromUtf32(0xF171)
GitLab = [char]::ConvertFromUtf32(0xF296)
}
}
PromptSymbols = @{
StartSymbol = ' '
TruncatedFolderSymbol = '..'
PromptIndicator = [char]::ConvertFromUtf32(0x25B6)
FailedCommandSymbol = [char]::ConvertFromUtf32(0x2A2F)
ElevatedSymbol = [char]::ConvertFromUtf32(0x26A1)
SegmentForwardSymbol = [char]::ConvertFromUtf32(0xE0B0)
SegmentBackwardSymbol = [char]::ConvertFromUtf32(0x26A1)
SegmentSeparatorForwardSymbol = [char]::ConvertFromUtf32(0x26A1)
SegmentSeparatorBackwardSymbol = [char]::ConvertFromUtf32(0x26A1)
PathSeparator = [System.IO.Path]::DirectorySeparatorChar
VirtualEnvSymbol = [char]::ConvertFromUtf32(0xE606)
PromptSymbols = @{
StartSymbol = ' '
TruncatedFolderSymbol = '..'
PromptIndicator = [char]::ConvertFromUtf32(0x25B6)
FailedCommandSymbol = [char]::ConvertFromUtf32(0x2A2F)
ElevatedSymbol = [char]::ConvertFromUtf32(0x26A1)
SegmentForwardSymbol = [char]::ConvertFromUtf32(0xE0B0)
SegmentBackwardSymbol = [char]::ConvertFromUtf32(0x26A1)
SegmentSeparatorForwardSymbol = [char]::ConvertFromUtf32(0x26A1)
SegmentSeparatorBackwardSymbol = [char]::ConvertFromUtf32(0x26A1)
PathSeparator = [System.IO.Path]::DirectorySeparatorChar
VirtualEnvSymbol = [char]::ConvertFromUtf32(0xE606)
}
Colors = @{
GitDefaultColor = [ConsoleColor]::DarkGreen
Expand Down

0 comments on commit e8eed6c

Please sign in to comment.