X Tutup
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,33 @@ internal static void ShowUpdateNotification(PSHostUserInterface hostUI)
? ManagedEntranceStrings.StableUpdateNotificationMessage
: ManagedEntranceStrings.PreviewUpdateNotificationMessage;

string notificationMsg = string.Format(CultureInfo.CurrentCulture, notificationMsgTemplate, releaseTag);
string notificationColor = string.Empty;
string resetColor = string.Empty;

string line2Padding = string.Empty;
string line3Padding = string.Empty;

// We calculate how much whitespace we need to make it look nice
if (hostUI.SupportsVirtualTerminal)
{
// Use Warning Color
notificationColor = "\x1B[7m";
resetColor = "\x1B[0m";

// The first line is longest, if the message changes, this needs to be updated
int line1Length = notificationMsgTemplate.IndexOf('\n');
int line2Length = notificationMsgTemplate.IndexOf('\n', line1Length + 1);
int line3Length = notificationMsgTemplate.IndexOf('\n', line2Length + 1);
line3Length -= line2Length + 1;
line2Length -= line1Length + 1;

line2Padding = line2Padding.PadRight(line1Length - line2Length + releaseTag.Length);
// 3 represents the extra placeholder in the template
line3Padding = line3Padding.PadRight(line1Length - line3Length + 3);
}

string notificationMsg = string.Format(CultureInfo.CurrentCulture, notificationMsgTemplate, releaseTag, notificationColor, resetColor, line2Padding, line3Padding);

hostUI.WriteLine(notificationMsg);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ Type 'help' to get help.</value>
<value>Warning: PowerShell detected that you might be using a screen reader and has disabled PSReadLine for compatibility purposes. If you want to re-enable it, run 'Import-Module PSReadLine'.</value>
</data>
<data name="PreviewUpdateNotificationMessage" xml:space="preserve">
<value>!! A new PowerShell preview release is available: v{0} !!
Upgrade now, or check out the release page at:
https://github.com/PowerShell/PowerShell/releases/tag/v{0}
<value> {1} A new PowerShell preview release is available: v{0} {2}
{1} Upgrade now, or check out the release page at:{3}{2}
{1} https://aka.ms/PowerShell-Release?tag=v{0} {4}{2}
</value>
</data>
<data name="StableUpdateNotificationMessage" xml:space="preserve">
<value>!! A new PowerShell stable release is available: v{0} !!
Upgrade now, or check out the release page at:
https://github.com/PowerShell/PowerShell/releases/tag/v{0}
<value> {1} A new PowerShell stable release is available: v{0} {2}
{1} Upgrade now, or check out the release page at:{3}{2}
{1} https://aka.ms/PowerShell-Release?tag=v{0} {4}{2}
</value>
</data>
<data name="UsageHelp" xml:space="preserve">
Expand Down
X Tutup