-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMicrosoft.PowerShell_profile.ps1
More file actions
51 lines (41 loc) · 1.52 KB
/
Microsoft.PowerShell_profile.ps1
File metadata and controls
51 lines (41 loc) · 1.52 KB
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
$global:ExebirCaminhoCompleto = $false
function prompt {
$PastaAtual = Get-Location
$DiscoAtual = [System.IO.Path]::GetPathRoot($PastaAtual.Path)
$top = [char]0x250C + [char]0x2500 + [char]0x2500
$bottom = [char]0x2514 + [char]0x003E
$open = [char]0x005B
$close = [char]0x005D
# Quebra o caminho em partes
$ParteDoCaminho = $PastaAtual.Path -split '\\'
# Verifica fullpath esta ativado.
if ($global:ExebirCaminhoCompleto -eq $false){
# Verifica se há mais de 3 partes
if ($ParteDoCaminho.Count -gt 3) {
# Pega as últimas 2 pastas
$CaminhoExibido = "$DiscoAtual..." + ($ParteDoCaminho[-2..-1] -join '\')
}
else { # Se o caminho tiver 3 ou menos pastas, mostra o caminho completo
$CaminhoExibido = $PastaAtual.Path
}
}
else{
$CaminhoExibido = $PastaAtual.Path
}
# Formata as cores e estilo.
Write-Host " "
Write-Host $top -ForegroundColor Green -NoNewline
Write-Host $open -ForegroundColor Blue -NoNewline
Write-Host "$CaminhoExibido" -ForegroundColor Yellow -NoNewline
Write-Host $close -ForegroundColor Blue
Write-Host $bottom -ForegroundColor Green -NoNewline
return " "
}
# alterna a exbição do caminho.
function fullpath {
if ($global:ExebirCaminhoCompleto -eq $false){
$global:ExebirCaminhoCompleto = $true
} else {
$global:ExebirCaminhoCompleto = $false
}
}