-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathPromptConfiguration.psd1
89 lines (89 loc) · 2.62 KB
/
PromptConfiguration.psd1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
@{
Plugins = @(
@{
Name = 'PSProfile.Prompt'
}
)
Prompts = @{
Basic = '
"PS $($executionContext.SessionState.Path.CurrentLocation)$(''>'' * ($nestedPromptLevel + 1)) ";
# .Link
# https://go.microsoft.com/fwlink/?LinkID=225750
# .ExternalHelp System.Management.Automation.dll-help.xml
'
BasicPlus = '
-join @(
''<# PS {0} | '' -f (Get-PSVersion)
Get-PathAlias
'' #> ''
)
'
Detailed = ' $lastStatus = $?
$lastColor = if ($lastStatus -eq $true) {
''Green''
}
else {
"Red"
}
if ($PSVersionTable.PSVersion.Major -le 5 -or $IsWindows) {
$os = ''WIN''
$idCol = ''Cyan''
}
elseif ($IsLinux) {
$os = ''LIN''
$idCol = ''Green''
}
elseif ($IsMacOS) {
$os = ''MAC''
$idCol = ''Yellow''
}
else {
$os = ''''
$idCol = ''White''
}
Write-Host "[" -NoNewline
Write-Host -ForegroundColor $idCol "$($os)#$($MyInvocation.HistoryId)" -NoNewline
Write-Host "] " -NoNewline
Write-Host "[" -NoNewLine
$verColor = @{
ForegroundColor = if ($PSVersionTable.PSVersion.Major -eq 7) {
''Yellow''
}
elseif ($PSVersionTable.PSVersion.Major -eq 6) {
''Magenta''
}
else {
''Cyan''
}
}
Write-Host @verColor ("PS {0}" -f (Get-PSVersion)) -NoNewline
Write-Host "] " -NoNewline
Write-Host "[" -NoNewline
Write-Host -ForegroundColor $lastColor ("{0}" -f (Get-Elapsed)) -NoNewline
Write-Host "] [" -NoNewline
Write-Host ("{0}" -f $(Get-PathAlias)) -NoNewline -ForegroundColor DarkYellow
Write-Host "]" -NoNewline
if ($PWD.Path -notlike "\\*" -and $env:DisablePoshGit -ne $true -and (Test-IfGit)) {
Write-VcsStatus
$GitPromptSettings.EnableWindowTitle = ''PS {0} @'' -f (Get-PSVersion)
}
else {
$Host.UI.RawUI.WindowTitle = ''PS {0}'' -f (Get-PSVersion)
}
"`n>> "
'
Clean = '
$global:CleanNumber++
-join @(
''[CLN#''
$global:CleanNumber
''] [''
[Math]::Round((Get-History -Count 1).Duration.TotalMilliseconds,0)
''ms] ''
$(Get-PathAlias)
("`n[PS {0}" -f (Get-PSVersion))
'']>> ''
)
'
}
}