internal/prompts/hyper.prompt.ps1

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
#region Helpers
function frame
{
    [CmdletBinding()]
    Param (
        $Text
    )
    
    Write-Host $Text @splatFrame
}

function cont
{
    [CmdletBinding()]
    Param (
        $Text
    )
    
    Write-Host $Text @splatContent
}
#endregion Helpers

$Arr = [char]9658
#region Time Section
$splatFrame = @{
    ForegroundColor          = "DarkGray"
    BackgroundColor          = "Gray"
    NoNewLine              = $true
}

$splatContent = @{
    ForegroundColor          = "Black"
    BackgroundColor          = "Gray"
    NoNewLine              = $true
}

frame "$Arr ["
cont "$(Get-Date -Format "HH:mm:ss")"
frame "] "

$history = (Get-History)[-1]

cont "$($history.StartExecutionTime.ToString("HH:mm:ss"))"
frame " | "
cont ($history.EndExecutionTime - $history.StartExecutionTime).ToString().Split(".")[0]
frame " | "
cont "$($history.EndExecutionTime.ToString("HH:mm:ss"))"

frame " "
#endregion Time Section

#region Path Section
$splatFrame = @{
    ForegroundColor          = "Cyan"
    BackgroundColor          = "DarkGray"
    NoNewLine              = $true
}

$splatContent = @{
    ForegroundColor           = "Green"
    BackgroundColor           = "DarkGray"
    NoNewLine               = $true
}

frame "$Arr "
cont $executionContext.SessionState.Path.CurrentLocation.Drive.Provider.Name
frame " | "
cont $executionContext.SessionState.Path.CurrentLocation.Drive.Name
frame " | "
cont $executionContext.SessionState.Path.CurrentLocation.ProviderPath
frame " $("$Arr" * (1 + $NestedPromptLevel)) "
#endregion Path Section

Write-Host ""
" "