8000 Fix prompt settings ambiguity · PoshCode/PSGit@fade1b5 · GitHub
[go: up one dir, main page]

Skip to content

Commit fade1b5

Browse files
committed
Fix prompt settings ambiguity
1 parent 97b0b2f commit fade1b5

File tree

4 files changed

+84
-93
lines changed

4 files changed

+84
-93
lines changed

src/Configuration.psd1

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,27 @@
3232
Foreground = ConsoleColor Green
3333
Background = ConsoleColor Black
3434
}
35-
After = PSObject @{
35+
BeforeChanges = PSObject @{
36+
Object = "["
37+
Foreground = ConsoleColor White
38+
Background = ConsoleColor Black
39+
}
40+
AfterChanges = PSObject @{
41+
Object = "]:"
42+
Foreground = ConsoleColor White
43+
Background = ConsoleColor Black
44+
}
45+
StagedChanges = PSObject @{
46+
Object = ""
47+
Foreground = ConsoleColor White
48+
Background = ConsoleColor Black
49+
}
50+
UnStagedChanges = PSObject @{
51+
Object = ""
52+
Foreground = ConsoleColor White
53+
Background = ConsoleColor Black
54+
}
55+
AfterNoChanges = PSObject @{
3656
Object = "]:"
3757
Foreground = ConsoleColor White
3858
Background = ConsoleColor Black

src/PSGit.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
RootModule = 'PSGit.psm1'
55

66
# Version number of this module.
7-
ModuleVersion = '2.0.3'
7+
ModuleVersion = '2.0.4'
88

99
# ID used to uniquely identify this module
1010
GUID = 'df52529c-a328-4ee1-b52c-839646292588'

src/PSGitPowerline.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ function New-PowerLineBlock {
2121
}
2222
}
2323

24-
function Get-StatusPowerLine {
24+
Set-Alias Get-StatusPowerLine Write-StatusPowerLine
25+
function Write-StatusPowerLine {
2526
[CmdletBinding()]
2627
param (
2728
$Status,

src/PSGitPrompt.ps1

Lines changed: 60 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,89 @@
11
function Set-PromptSettings {
22
[CmdletBinding()]
33
param(
4-
[string]$BeforeText = "[",
5-
[ConsoleColor]$BeforeForeground,
6-
[ConsoleColor]$BeforeBackground,
4+
[string]$AfterChangesText = "]:",
5+
[ConsoleColor]$AfterChangesForeground,
6+
[ConsoleColor]$AfterChangesBackground,
77

8-
[string]$BranchText = $([char]0x03BB),
9-
[ConsoleColor]$BranchForeground,
10-
[ConsoleColor]$BranchBackground,
8+
[string]$AfterNoChangesText = "]:",
9+
[ConsoleColor]$AfterNoChangesForeground,
10+
[ConsoleColor]$AfterNoChangesBackground,
1111

12+
[string]$AheadByText = '',
1213
[ConsoleColor]$AheadByForeground,
1314
[ConsoleColor]$AheadByBackground,
1415

16+
[string]$BehindByText = '',
1517
[ConsoleColor]$BehindByForeground,
1618
[ConsoleColor]$BehindByBackground,
1719

18-
[string]$BeforeChanges = '',
20+
[string]$BeforeText = "[",
21+
[ConsoleColor]$BeforeForeground,
22+
[ConsoleColor]$BeforeBackground,
23+
24+
[string]$BranchText = $([char]0x03BB),
25+
[ConsoleColor]$BranchForeground,
26+
[ConsoleColor]$BranchBackground,
27+
28+
[string]$BeforeChangesText = '',
1929
[ConsoleColor]$BeforeChangesForeground,
2030
[ConsoleColor]$BeforeChangesBackground,
2131

22-
[ConsoleColor]$StagedChangesForeground,
23-
[ConsoleColor]$StagedChangesBackground,
24-
25-
[string]$Separator = '|',
32+
[string]$SeparatorText = '|',
2633
[ConsoleColor]$SeparatorForeground,
2734
[ConsoleColor]$SeparatorBackground,
2835

36+
[ConsoleColor]$StagedChangesForeground,
37+
[ConsoleColor]$StagedChangesBackground,
38+
2939
[ConsoleColor]$UnStagedChangesForeground,
3040
[ConsoleColor]$UnStagedChangesBackground,
3141

32-
[string]$AfterChanges = "]:",
33-
[ConsoleColor]$AfterChangesForeground,
34-
[ConsoleColor]$AfterChangesBackground,
35-
36-
[string]$AfterNoChanges = "]:",
37-
[ConsoleColor]$AfterNoChangesForeground,
38-
[ConsoleColor]$AfterNoChangesBackground,
3942
[Switch]$HideZero
4043
)
4144

4245
$config = Import-Configuration
4346

4447
switch($PSBoundParameters.Keys) {
45-
"BeforeText" {
46-
$config.Before.Object = $PSBoundParameters[$_]
47-
}
48-
"BeforeForeground" {
49-
$config.Before.Foreground = $PSBoundParameters[$_]
50-
}
51-
"BeforeBackground" {
52-
$config.Before.Background = $PSBoundParameters[$_]
53-
}
54-
"BranchText" {
55-
$config.Branch.Object = $PSBoundParameters[$_]
56-
}
57-
"BranchForeground" {
58-
$config.Branch.Foreground = $PSBoundParameters[$_]
59-
}
60-
"BranchBackground" {
61-
$config.Branch.Background = $PSBoundParameters[$_]
62-
}
63-
"AheadByForeground" {
64-
$config.AheadBy.Foreground = $PSBoundParameters[$_]
65-
}
66-
"AheadByBackground" {
67-
$config.AheadBy.Background = $PSBoundParameters[$_]
68-
}
69-
"BehindByForeground" {
70-
$config.BehindBy.Foreground = $PSBoundParameters[$_]
71-
}
72-
"BehindByBackground" {
73-
$config.BehindBy.Background = $PSBoundParameters[$_]
74-
}
75-
"BeforeChangesText" {
76-
$config.BeforeChanges.Object = $PSBoundParameters[$_]
77-
}
78-
"BeforeChangesForeground" {
79-
$config.BeforeChanges.Foreground = $PSBoundParameters[$_]
80-
}
81-
"BeforeChangesBackground" {
82-
$config.BeforeChanges.Background = $PSBoundParameters[$_]
83-
}
84-
"StagedChangesForeground" {
85-
$config.StagedChanges.Foreground = $PSBoundParameters[$_]
86-
}
87-
"StagedChangesBackground" {
88-
$config.StagedChanges.Background = $PSBoundParameters[$_]
89-
}
90-
"UnStagedChangesForeground" {
91-
$config.UnStagedChanges.Foreground = $PSBoundParameters[$_]
92-
}
93-
"UnStagedChangesBackground" {
94-
$config.UnStagedChanges.Background = $PSBoundParameters[$_]
95-
}
96-
"AfterChangesText" {
97-
$config.AfterChanges.Object = $PSBoundParameters[$_]
98-
}
99-
"AfterChangesForeground" {
100-
$config.AfterChanges.Foreground = $PSBoundParameters[$_]
101-
}
102-
"AfterChangesBackground" {
103-
$config.AfterChanges.Background = $PSBoundParameters[$_]
104-
}
105-
"AfterNoChangesText" {
106-
$config.AfterNoChanges.Object = $PSBoundParameters[$_]
107-
}
108-
"AfterNoChangesForeground" {
109-
$config.AfterNoChanges.Foreground = $PSBoundParameters[$_]
110-
}
111-
"AfterNoChangesBackground" {
112-
$config.AfterNoChanges.Background = $PSBoundParameters[$_]
113-
}
114-
"HideZero" {
115-
$Config.HideZero = $PSBoundParameters[$_]
116-
}
48+
"AfterChangesText" { $config.AfterChanges.Object = $PSBoundParameters[$_] }
49+
"AfterChangesBackground" { $config.AfterChanges.Background = $PSBoundParameters[$_] }
50+
"AfterChangesForeground" { $config.AfterChanges.Foreground = $PSBoundParameters[$_] }
51+
52+
"AfterNoChangesText" { $config.AfterNoChanges.Object = $PSBoundParameters[$_] }
53+
"AfterNoChangesBackground" { $config.AfterNoChanges.Background = $PSBoundParameters[$_] }
54+
"AfterNoChangesForeground" { $config.AfterNoChanges.Foreground = $PSBoundParameters[$_] }
55+
56+
"AheadByText" { $config.AheadBy.Object = $PSBoundParameters[$_] }
57+
"AheadByBackground" { $config.AheadBy.Background = $PSBoundParameters[$_] }
58+
"AheadByForeground" { $config.AheadBy.Foreground = $PSBoundParameters[$_] }
59+
60+
"BeforeText" { $config.Before.Object = $PSBoundParameters[$_] }
61+
"BeforeBackground" { $config.Before.Background = $PSBoundParameters[$_] }
62+
"BeforeForeground" { $config.Before.Foreground = $PSBoundParameters[$_] }
63+
64+
"BeforeChangesText" { $config.BeforeChanges.Object = $PSBoundParameters[$_] }
65+
"BeforeChangesBackground" { $config.BeforeChanges.Background = $PSBoundParameters[$_] }
66+
"BeforeChangesForeground" { $config.BeforeChanges.Foreground = $PSBoundParameters[$_] }
67+
68+
"BehindByText" { $config.BehindBy.Object = $PSBoundParameters[$_] }
69+
"BehindByBackground" { $config.BehindBy.Background = $PSBoundParameters[$_] }
70+
"BehindByForeground" { $config.BehindBy.Foreground = $PSBoundParameters[$_] }
71+
72+
"BranchText" { $config.Branch.Object = $PSBoundParameters[$_] }
73+
"BranchBackground" { $config.Branch.Background = $PSBoundParameters[$_] }
74+
"BranchForeground" { $config.Branch.Foreground = $PSBoundParameters[$_] }
75+
76+
"SeparatorText" { $Config.Separator.Object = $PSBoundParameters[$_] }
77+
"SeparatorBackground" { $Config.Separator.Background = $PSBoundParameters[$_] }
78+
"SeparatorForeground" { $Config.Separator.Foreground = $PSBoundParameters[$_] }
79+
80+
"StagedChangesBackground" { $config.StagedChanges.Background = $PSBoundParameters[$_] }
81+
"StagedChangesForeground" { $config.StagedChanges.Foreground = $PSBoundParameters[$_] }
82+
83+
"UnStagedChangesBackground" { $config.UnStagedChanges.Background = $PSBoundParameters[$_] }
84+
"UnStagedChangesForeground" { $config.UnStagedChanges.Foreground = $PSBoundParameters[$_] }
85+
86+
"HideZero" { $Config.HideZero = [bool]$HideZero }
11787
}
11888

11989
Export-Configuration $config

0 commit comments

Comments
 (0)
0