Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ public Guid InstanceId
/// <summary>
/// Gets or sets a flag that tells PowerShell to automatically perform a BreakAll when the debugger is attached to the remote target.
/// </summary>
[Experimental("Microsoft.PowerShell.Utility.PSManageBreakpointsInRunspace", ExperimentAction.Show)]
[Parameter]
public SwitchParameter BreakAll { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public string[] LiteralPath
/// <summary>
/// Gets or sets switch that determines if built-in limits are applied to the data.
/// </summary>
[Experimental("Microsoft.PowerShell.Utility.PSImportPSDataFileSkipLimitCheck", ExperimentAction.Show)]
[Parameter]
public SwitchParameter SkipLimitCheck { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public abstract class PSBreakpointCommandBase : PSCmdlet
/// <summary>
/// Gets or sets the runspace where the breakpoints will be used.
/// </summary>
[Experimental("Microsoft.PowerShell.Utility.PSManageBreakpointsInRunspace", ExperimentAction.Show)]
[Parameter]
[ValidateNotNull]
[Runspace]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,26 @@ internal ConsoleHostUserInterface(ConsoleHost parent)
SupportsVirtualTerminal = true;
_isInteractiveTestToolListening = false;

if (ExperimentalFeature.IsEnabled("PSAnsiRendering"))
// check if TERM env var is set
// `dumb` means explicitly don't use VT
// `xterm-mono` and `xtermm` means support VT, but emit plaintext
switch (Environment.GetEnvironmentVariable("TERM"))
{
// check if TERM env var is set
// `dumb` means explicitly don't use VT
// `xterm-mono` and `xtermm` means support VT, but emit plaintext
switch (Environment.GetEnvironmentVariable("TERM"))
{
case "dumb":
SupportsVirtualTerminal = false;
break;
case "xterm-mono":
case "xtermm":
PSStyle.Instance.OutputRendering = OutputRendering.PlainText;
break;
default:
break;
}

// widely supported by CLI tools via https://no-color.org/
if (Environment.GetEnvironmentVariable("NO_COLOR") != null)
{
case "dumb":
SupportsVirtualTerminal = false;
break;
case "xterm-mono":
case "xtermm":
PSStyle.Instance.OutputRendering = OutputRendering.PlainText;
}
break;
default:
break;
}

// widely supported by CLI tools via https://no-color.org/
if (Environment.GetEnvironmentVariable("NO_COLOR") != null)
{
PSStyle.Instance.OutputRendering = OutputRendering.PlainText;
}

if (SupportsVirtualTerminal)
Expand Down Expand Up @@ -1216,7 +1213,7 @@ public override void WriteDebugLine(string message)
}
else
{
if (SupportsVirtualTerminal && ExperimentalFeature.IsEnabled("PSAnsiRendering"))
if (SupportsVirtualTerminal)
{
WriteLine(Utils.GetFormatStyleString(Utils.FormatStyle.Debug) + StringUtil.Format(ConsoleHostUserInterfaceStrings.DebugFormatString, message) + PSStyle.Instance.Reset);
}
Expand Down Expand Up @@ -1277,7 +1274,7 @@ public override void WriteVerboseLine(string message)
}
else
{
if (SupportsVirtualTerminal && ExperimentalFeature.IsEnabled("PSAnsiRendering"))
if (SupportsVirtualTerminal)
{
WriteLine(Utils.GetFormatStyleString(Utils.FormatStyle.Verbose) + StringUtil.Format(ConsoleHostUserInterfaceStrings.VerboseFormatString, message) + PSStyle.Instance.Reset);
}
Expand Down Expand Up @@ -1321,7 +1318,7 @@ public override void WriteWarningLine(string message)
}
else
{
if (SupportsVirtualTerminal && ExperimentalFeature.IsEnabled("PSAnsiRendering"))
if (SupportsVirtualTerminal)
{
WriteLine(Utils.GetFormatStyleString(Utils.FormatStyle.Warning) + StringUtil.Format(ConsoleHostUserInterfaceStrings.WarningFormatString, message) + PSStyle.Instance.Reset);
}
Expand Down Expand Up @@ -1393,7 +1390,7 @@ public override void WriteErrorLine(string value)
{
if (writer == _parent.ConsoleTextWriter)
{
if (SupportsVirtualTerminal && ExperimentalFeature.IsEnabled("PSAnsiRendering"))
if (SupportsVirtualTerminal)
{
WriteLine(value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ConsoleHostUserInterface : System.Management.Automation.Host.PSHostUserInt

_pendingProgress = null;

if (SupportsVirtualTerminal && ExperimentalFeature.IsEnabled(ExperimentalFeature.PSAnsiProgressFeatureName) && PSStyle.Instance.Progress.UseOSCIndicator)
if (SupportsVirtualTerminal && PSStyle.Instance.Progress.UseOSCIndicator)
{
// OSC sequence to turn off progress indicator
// https://github.com/microsoft/terminal/issues/6700
Expand Down Expand Up @@ -99,7 +99,7 @@ class ConsoleHostUserInterface : System.Management.Automation.Host.PSHostUserInt
{
// Update the progress pane only when the timer set up the update flag or WriteProgress is completed.
// As a result, we do not block WriteProgress and whole script and eliminate unnecessary console locks and updates.
if (SupportsVirtualTerminal && ExperimentalFeature.IsEnabled(ExperimentalFeature.PSAnsiProgressFeatureName) && PSStyle.Instance.Progress.UseOSCIndicator)
if (SupportsVirtualTerminal && PSStyle.Instance.Progress.UseOSCIndicator)
{
int percentComplete = record.PercentComplete;
if (percentComplete < 0)
Expand All @@ -115,7 +115,7 @@ class ConsoleHostUserInterface : System.Management.Automation.Host.PSHostUserInt
}

// If VT is not supported, we change ProgressView to classic
if (!SupportsVirtualTerminal && ExperimentalFeature.IsEnabled(ExperimentalFeature.PSAnsiProgressFeatureName))
if (!SupportsVirtualTerminal)
{
PSStyle.Instance.Progress.View = ProgressView.Classic;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ private static void RenderFullDescription(string description, string indent, int

internal static bool IsMinimalProgressRenderingEnabled()
{
return ExperimentalFeature.IsEnabled(ExperimentalFeature.PSAnsiProgressFeatureName) && PSStyle.Instance.Progress.View == ProgressView.Minimal;
return PSStyle.Instance.Progress.View == ProgressView.Minimal;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class ProgressPane

// create cleared region to clear progress bar later
_savedRegion = tempProgressRegion;
if (ExperimentalFeature.IsEnabled(ExperimentalFeature.PSAnsiProgressFeatureName) && PSStyle.Instance.Progress.View != ProgressView.Minimal)
if (PSStyle.Instance.Progress.View != ProgressView.Minimal)
{
for (int row = 0; row < rows; row++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,24 @@ internal static IEnumerable<ExtendedTypeDefinition> GetFormatData()
private static IEnumerable<FormatViewDefinition> ViewsOf_FileSystemTypes(CustomControl[] sharedControls)
{
#if UNIX
if (ExperimentalFeature.IsEnabled("PSUnixFileStat"))
{
yield return new FormatViewDefinition("childrenWithUnixStat",
TableControl.Create()
.GroupByProperty("PSParentPath", customControl: sharedControls[0])
.AddHeader(Alignment.Left, label: "UnixMode", width: 10)
.AddHeader(Alignment.Left, label: "User", width: 16)
.AddHeader(Alignment.Left, label: "Group", width: 16)
.AddHeader(Alignment.Right, label: "LastWriteTime", width: 18)
.AddHeader(Alignment.Right, label: "Size", width: 14)
.AddHeader(Alignment.Left, label: "Name")
.StartRowDefinition(wrap: true)
.AddPropertyColumn("UnixMode")
.AddPropertyColumn("User")
.AddPropertyColumn("Group")
.AddScriptBlockColumn(scriptBlock: @"'{0:d} {0:HH}:{0:mm}' -f $_.LastWriteTime")
.AddPropertyColumn("Size")
.AddPropertyColumn("NameString")
.EndRowDefinition()
.EndTable());
}
yield return new FormatViewDefinition("childrenWithUnixStat",
TableControl.Create()
.GroupByProperty("PSParentPath", customControl: sharedControls[0])
.AddHeader(Alignment.Left, label: "UnixMode", width: 10)
.AddHeader(Alignment.Left, label: "User", width: 16)
.AddHeader(Alignment.Left, label: "Group", width: 16)
.AddHeader(Alignment.Right, label: "LastWriteTime", width: 18)
.AddHeader(Alignment.Right, label: "Size", width: 14)
.AddHeader(Alignment.Left, label: "Name")
.StartRowDefinition(wrap: true)
.AddPropertyColumn("UnixMode")
.AddPropertyColumn("User")
.AddPropertyColumn("Group")
.AddScriptBlockColumn(scriptBlock: @"'{0:d} {0:HH}:{0:mm}' -f $_.LastWriteTime")
.AddPropertyColumn("Size")
.AddPropertyColumn("NameString")
.EndRowDefinition()
.EndTable());
#endif

yield return new FormatViewDefinition("children",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,25 +222,11 @@ private void WriteSingleLineHelper(string prependString, string line, LineOutput
{
if (k == 0)
{
if (ExperimentalFeature.IsEnabled("PSAnsiRendering"))
{
lo.WriteLine(PSStyle.Instance.Formatting.FormatAccent + prependString + PSStyle.Instance.Reset + sc[k]);
}
else
{
lo.WriteLine(prependString + sc[k]);
}
lo.WriteLine(PSStyle.Instance.Formatting.FormatAccent + prependString + PSStyle.Instance.Reset + sc[k]);
}
else
{
if (ExperimentalFeature.IsEnabled("PSAnsiRendering"))
{
lo.WriteLine(padding + PSStyle.Instance.Formatting.FormatAccent + PSStyle.Instance.Reset + sc[k]);
}
else
{
lo.WriteLine(padding + sc[k]);
}
lo.WriteLine(padding + PSStyle.Instance.Formatting.FormatAccent + PSStyle.Instance.Reset + sc[k]);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ private sealed class ScreenInfo
private ScreenInfo _si;

private const char ESC = '\u001b';
private const string ResetConsoleVt100Code = "\u001b[m";

private List<string> _header;

Expand Down Expand Up @@ -156,14 +155,7 @@ internal int GenerateHeader(string[] values, LineOutput lo)
{
foreach (string line in _header)
{
if (ExperimentalFeature.IsEnabled("PSAnsiRendering"))
{
lo.WriteLine(PSStyle.Instance.Formatting.TableHeader + line + PSStyle.Instance.Reset);
}
else
{
lo.WriteLine(line);
}
lo.WriteLine(PSStyle.Instance.Formatting.TableHeader + line + PSStyle.Instance.Reset);
}

return _header.Count;
Expand Down Expand Up @@ -241,7 +233,7 @@ internal void GenerateRow(string[] values, LineOutput lo, bool multiLine, ReadOn
foreach (string line in GenerateTableRow(values, currentAlignment, lo.DisplayCells))
{
generatedRows?.Add(line);
if (ExperimentalFeature.IsEnabled("PSAnsiRendering") && isHeader)
if (isHeader)
{
lo.WriteLine(PSStyle.Instance.Formatting.TableHeader + line + PSStyle.Instance.Reset);
}
Expand All @@ -255,7 +247,7 @@ internal void GenerateRow(string[] values, LineOutput lo, bool multiLine, ReadOn
{
string line = GenerateRow(values, currentAlignment, dc);
generatedRows?.Add(line);
if (ExperimentalFeature.IsEnabled("PSAnsiRendering") && isHeader)
if (isHeader)
{
lo.WriteLine(PSStyle.Instance.Formatting.TableHeader + line + PSStyle.Instance.Reset);
}
Expand Down Expand Up @@ -469,15 +461,7 @@ private string GenerateRow(string[] values, ReadOnlySpan<int> alignment, Display
if (values[k].Contains(ESC))
{
// Reset the console output if the content of this column contains ESC
if (ExperimentalFeature.IsEnabled("PSAnsiRendering"))
{
// Remove definition of `ResetConsoleVt10Code` when PSAnsiRendering is not experimental
sb.Append(PSStyle.Instance.Reset);
}
else
{
sb.Append(ResetConsoleVt100Code);
}
sb.Append(PSStyle.Instance.Reset);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public class ExperimentalFeature
#region Const Members

internal const string EngineSource = "PSEngine";
internal const string PSAnsiProgressFeatureName = "PSAnsiProgress";
internal const string PSNativeCommandArgumentPassingFeatureName = "PSNativeCommandArgumentPassing";

#endregion
Expand Down Expand Up @@ -111,29 +110,12 @@ static ExperimentalFeature()
new ExperimentalFeature(
name: "PSCommandNotFoundSuggestion",
description: "Recommend potential commands based on fuzzy search on a CommandNotFoundException"),
#if UNIX
new ExperimentalFeature(
name: "PSUnixFileStat",
description: "Provide unix permission information for files and directories"),
#endif
new ExperimentalFeature(
name: "PSCultureInvariantReplaceOperator",
description: "Use culture invariant to-string convertor for lval in replace operator"),
new ExperimentalFeature(
name: "PSNativePSPathResolution",
description: "Convert PSPath to filesystem path, if possible, for native commands"),
new ExperimentalFeature(
name: "PSNotApplyErrorActionToStderr",
description: "Don't have $ErrorActionPreference affect stderr output"),
new ExperimentalFeature(
name: "PSSubsystemPluginModel",
description: "A plugin model for registering and un-registering PowerShell subsystems"),
new ExperimentalFeature(
name: "PSAnsiRendering",
description: "Enable $PSStyle variable to control ANSI rendering of strings"),
new ExperimentalFeature(
name: PSAnsiProgressFeatureName,
description: "Enable lightweight progress bar that leverages ANSI codes for rendering"),
new ExperimentalFeature(
name: PSNativeCommandArgumentPassingFeatureName,
description: "Use ArgumentList when invoking a native command"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2839,7 +2839,7 @@ internal void _WriteErrorSkipAllowCheck(ErrorRecord errorRecord, ActionPreferenc
this.PipelineProcessor.LogExecutionError(_thisCommand.MyInvocation, errorRecord);
}

if (!(ExperimentalFeature.IsEnabled("PSNotApplyErrorActionToStderr") && isNativeError))
if (!isNativeError)
{
this.PipelineProcessor.ExecutionFailed = true;

Expand Down
Loading