From 9cc2c2d9b37a873bf3d65a751878caa1070b0920 Mon Sep 17 00:00:00 2001 From: Matthias Koch Date: Thu, 4 May 2023 01:07:20 +0200 Subject: [PATCH] Regenerate --- .../GitReleaseManager.Generated.cs | 170 +- .../Nuke.Common/Tools/Pwsh/Pwsh.Generated.cs | 1371 +++++++++++++++++ 2 files changed, 1536 insertions(+), 5 deletions(-) create mode 100644 source/Nuke.Common/Tools/Pwsh/Pwsh.Generated.cs diff --git a/source/Nuke.Common/Tools/GitReleaseManager/GitReleaseManager.Generated.cs b/source/Nuke.Common/Tools/GitReleaseManager/GitReleaseManager.Generated.cs index 85a708daf..1e22cf780 100644 --- a/source/Nuke.Common/Tools/GitReleaseManager/GitReleaseManager.Generated.cs +++ b/source/Nuke.Common/Tools/GitReleaseManager/GitReleaseManager.Generated.cs @@ -59,6 +59,7 @@ public static IReadOnlyCollection GitReleaseManager(ref ArgumentStringHa ///
  • --repository via
  • ///
  • --tagName via
  • ///
  • --targetDirectory via
  • + ///
  • --token via
  • ///
  • --username via
  • /// /// @@ -83,6 +84,7 @@ public static IReadOnlyCollection GitReleaseManagerAddAssets(GitReleaseM ///
  • --repository via
  • ///
  • --tagName via
  • ///
  • --targetDirectory via
  • + ///
  • --token via
  • ///
  • --username via
  • /// /// @@ -104,6 +106,7 @@ public static IReadOnlyCollection GitReleaseManagerAddAssets(Configure--repository via ///
  • --tagName via
  • ///
  • --targetDirectory via
  • + ///
  • --token via
  • ///
  • --username via
  • /// /// @@ -124,6 +127,7 @@ public static IReadOnlyCollection GitReleaseManagerAddAssets(Configure--password via ///
  • --repository via
  • ///
  • --targetDirectory via
  • + ///
  • --token via
  • ///
  • --username via
  • /// /// @@ -147,6 +151,7 @@ public static IReadOnlyCollection GitReleaseManagerClose(GitReleaseManag ///
  • --password via
  • ///
  • --repository via
  • ///
  • --targetDirectory via
  • + ///
  • --token via
  • ///
  • --username via
  • /// /// @@ -167,6 +172,7 @@ public static IReadOnlyCollection GitReleaseManagerClose(Configure--password via ///
  • --repository via
  • ///
  • --targetDirectory via
  • + ///
  • --token via
  • ///
  • --username via
  • /// /// @@ -192,6 +198,7 @@ public static IReadOnlyCollection GitReleaseManagerClose(Configure--repository via ///
  • --targetcommitish via
  • ///
  • --targetDirectory via
  • + ///
  • --token via
  • ///
  • --username via
  • /// /// @@ -220,6 +227,7 @@ public static IReadOnlyCollection GitReleaseManagerCreate(GitReleaseMana ///
  • --repository via
  • ///
  • --targetcommitish via
  • ///
  • --targetDirectory via
  • + ///
  • --token via
  • ///
  • --username via
  • /// /// @@ -245,6 +253,7 @@ public static IReadOnlyCollection GitReleaseManagerCreate(Configure--repository via ///
  • --targetcommitish via
  • ///
  • --targetDirectory via
  • + ///
  • --token via
  • ///
  • --username via
  • /// /// @@ -266,6 +275,7 @@ public static IReadOnlyCollection GitReleaseManagerCreate(Configure--repository via ///
  • --tagName via
  • ///
  • --targetDirectory via
  • + ///
  • --token via
  • ///
  • --username via
  • /// /// @@ -290,6 +300,7 @@ public static IReadOnlyCollection GitReleaseManagerExport(GitReleaseMana ///
  • --repository via
  • ///
  • --tagName via
  • ///
  • --targetDirectory via
  • + ///
  • --token via
  • ///
  • --username via
  • /// /// @@ -311,6 +322,7 @@ public static IReadOnlyCollection GitReleaseManagerExport(Configure--repository via ///
  • --tagName via
  • ///
  • --targetDirectory via
  • + ///
  • --token via
  • ///
  • --username via
  • /// /// @@ -331,6 +343,7 @@ public static IReadOnlyCollection GitReleaseManagerExport(Configure--repository via ///
  • --tagName via
  • ///
  • --targetDirectory via
  • + ///
  • --token via
  • ///
  • --username via
  • /// /// @@ -354,6 +367,7 @@ public static IReadOnlyCollection GitReleaseManagerPublish(GitReleaseMan ///
  • --repository via
  • ///
  • --tagName via
  • ///
  • --targetDirectory via
  • + ///
  • --token via
  • ///
  • --username via
  • /// /// @@ -374,6 +388,7 @@ public static IReadOnlyCollection GitReleaseManagerPublish(Configure--repository via ///
  • --tagName via
  • ///
  • --targetDirectory via
  • + ///
  • --token via
  • ///
  • --username via
  • /// /// @@ -429,6 +444,10 @@ public partial class GitReleaseManagerAddAssetsSettings : ToolSettings /// Path to where log file should be created. Defaults is logging to console. /// public virtual string LogFilePath { get; internal set; } + /// + /// The access token to access GitHub with. + /// + public virtual string Token { get; internal set; } protected override Arguments ConfigureProcessArguments(Arguments arguments) { arguments @@ -440,7 +459,8 @@ protected override Arguments ConfigureProcessArguments(Arguments arguments) .Add("--owner {value}", RepositoryOwner) .Add("--repository {value}", RepositoryName) .Add("--targetDirectory {value}", TargetDirectory) - .Add("--logFilePath {value}", LogFilePath); + .Add("--logFilePath {value}", LogFilePath) + .Add("--token {value}", Token); return base.ConfigureProcessArguments(arguments); } } @@ -487,6 +507,10 @@ public partial class GitReleaseManagerCloseSettings : ToolSettings /// Path to where log file should be created. Defaults is logging to console. /// public virtual string LogFilePath { get; internal set; } + /// + /// The access token to access GitHub with. + /// + public virtual string Token { get; internal set; } protected override Arguments ConfigureProcessArguments(Arguments arguments) { arguments @@ -497,7 +521,8 @@ protected override Arguments ConfigureProcessArguments(Arguments arguments) .Add("--owner {value}", RepositoryOwner) .Add("--repository {value}", RepositoryName) .Add("--targetDirectory {value}", TargetDirectory) - .Add("--logFilePath {value}", LogFilePath); + .Add("--logFilePath {value}", LogFilePath) + .Add("--token {value}", Token); return base.ConfigureProcessArguments(arguments); } } @@ -565,6 +590,10 @@ public partial class GitReleaseManagerCreateSettings : ToolSettings /// Path to where log file should be created. Defaults is logging to console. /// public virtual string LogFilePath { get; internal set; } + /// + /// The access token to access GitHub with. + /// + public virtual string Token { get; internal set; } protected override Arguments ConfigureProcessArguments(Arguments arguments) { arguments @@ -580,7 +609,8 @@ protected override Arguments ConfigureProcessArguments(Arguments arguments) .Add("--owner {value}", RepositoryOwner) .Add("--repository {value}", RepositoryName) .Add("--targetDirectory {value}", TargetDirectory) - .Add("--logFilePath {value}", LogFilePath); + .Add("--logFilePath {value}", LogFilePath) + .Add("--token {value}", Token); return base.ConfigureProcessArguments(arguments); } } @@ -631,6 +661,10 @@ public partial class GitReleaseManagerExportSettings : ToolSettings /// Path to where log file should be created. Defaults is logging to console. /// public virtual string LogFilePath { get; internal set; } + /// + /// The access token to access GitHub with. + /// + public virtual string Token { get; internal set; } protected override Arguments ConfigureProcessArguments(Arguments arguments) { arguments @@ -642,7 +676,8 @@ protected override Arguments ConfigureProcessArguments(Arguments arguments) .Add("--owner {value}", RepositoryOwner) .Add("--repository {value}", RepositoryName) .Add("--targetDirectory {value}", TargetDirectory) - .Add("--logFilePath {value}", LogFilePath); + .Add("--logFilePath {value}", LogFilePath) + .Add("--token {value}", Token); return base.ConfigureProcessArguments(arguments); } } @@ -689,6 +724,10 @@ public partial class GitReleaseManagerPublishSettings : ToolSettings /// Path to where log file should be created. Defaults is logging to console. /// public virtual string LogFilePath { get; internal set; } + /// + /// The access token to access GitHub with. + /// + public virtual string Token { get; internal set; } protected override Arguments ConfigureProcessArguments(Arguments arguments) { arguments @@ -699,7 +738,8 @@ protected override Arguments ConfigureProcessArguments(Arguments arguments) .Add("--owner {value}", RepositoryOwner) .Add("--repository {value}", RepositoryName) .Add("--targetDirectory {value}", TargetDirectory) - .Add("--logFilePath {value}", LogFilePath); + .Add("--logFilePath {value}", LogFilePath) + .Add("--token {value}", Token); return base.ConfigureProcessArguments(arguments); } } @@ -961,6 +1001,30 @@ public static T ResetLogFilePath(this T toolSettings) where T : GitReleaseMan return toolSettings; } #endregion + #region Token + /// + ///

    Sets

    + ///

    The access token to access GitHub with.

    + ///
    + [Pure] + public static T SetToken(this T toolSettings, string token) where T : GitReleaseManagerAddAssetsSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Token = token; + return toolSettings; + } + /// + ///

    Resets

    + ///

    The access token to access GitHub with.

    + ///
    + [Pure] + public static T ResetToken(this T toolSettings) where T : GitReleaseManagerAddAssetsSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Token = null; + return toolSettings; + } + #endregion } #endregion #region GitReleaseManagerCloseSettingsExtensions @@ -1139,6 +1203,30 @@ public static T ResetLogFilePath(this T toolSettings) where T : GitReleaseMan return toolSettings; } #endregion + #region Token + /// + ///

    Sets

    + ///

    The access token to access GitHub with.

    + ///
    + [Pure] + public static T SetToken(this T toolSettings, string token) where T : GitReleaseManagerCloseSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Token = token; + return toolSettings; + } + /// + ///

    Resets

    + ///

    The access token to access GitHub with.

    + ///
    + [Pure] + public static T ResetToken(this T toolSettings) where T : GitReleaseManagerCloseSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Token = null; + return toolSettings; + } + #endregion } #endregion #region GitReleaseManagerCreateSettingsExtensions @@ -1527,6 +1615,30 @@ public static T ResetLogFilePath(this T toolSettings) where T : GitReleaseMan return toolSettings; } #endregion + #region Token + /// + ///

    Sets

    + ///

    The access token to access GitHub with.

    + ///
    + [Pure] + public static T SetToken(this T toolSettings, string token) where T : GitReleaseManagerCreateSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Token = token; + return toolSettings; + } + /// + ///

    Resets

    + ///

    The access token to access GitHub with.

    + ///
    + [Pure] + public static T ResetToken(this T toolSettings) where T : GitReleaseManagerCreateSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Token = null; + return toolSettings; + } + #endregion } #endregion #region GitReleaseManagerExportSettingsExtensions @@ -1729,6 +1841,30 @@ public static T ResetLogFilePath(this T toolSettings) where T : GitReleaseMan return toolSettings; } #endregion + #region Token + /// + ///

    Sets

    + ///

    The access token to access GitHub with.

    + ///
    + [Pure] + public static T SetToken(this T toolSettings, string token) where T : GitReleaseManagerExportSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Token = token; + return toolSettings; + } + /// + ///

    Resets

    + ///

    The access token to access GitHub with.

    + ///
    + [Pure] + public static T ResetToken(this T toolSettings) where T : GitReleaseManagerExportSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Token = null; + return toolSettings; + } + #endregion } #endregion #region GitReleaseManagerPublishSettingsExtensions @@ -1907,5 +2043,29 @@ public static T ResetLogFilePath(this T toolSettings) where T : GitReleaseMan return toolSettings; } #endregion + #region Token + /// + ///

    Sets

    + ///

    The access token to access GitHub with.

    + ///
    + [Pure] + public static T SetToken(this T toolSettings, string token) where T : GitReleaseManagerPublishSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Token = token; + return toolSettings; + } + /// + ///

    Resets

    + ///

    The access token to access GitHub with.

    + ///
    + [Pure] + public static T ResetToken(this T toolSettings) where T : GitReleaseManagerPublishSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Token = null; + return toolSettings; + } + #endregion } #endregion diff --git a/source/Nuke.Common/Tools/Pwsh/Pwsh.Generated.cs b/source/Nuke.Common/Tools/Pwsh/Pwsh.Generated.cs new file mode 100644 index 000000000..a9832a768 --- /dev/null +++ b/source/Nuke.Common/Tools/Pwsh/Pwsh.Generated.cs @@ -0,0 +1,1371 @@ +// Generated from https://github.com/nuke-build/nuke/blob/master/source/Nuke.Common/Tools/Pwsh/Pwsh.json + +using JetBrains.Annotations; +using Newtonsoft.Json; +using Nuke.Common; +using Nuke.Common.Tooling; +using Nuke.Common.Tools; +using Nuke.Common.Utilities.Collections; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Linq; +using System.Text; + +namespace Nuke.Common.Tools.Pwsh; + +/// +///

    PowerShell is a cross-platform task automation solution made up of a command-line shell, a scripting language, and a configuration management framework. PowerShell runs on Windows, Linux, and macOS.

    +///

    For more details, visit the official website.

    +///
    +[PublicAPI] +[ExcludeFromCodeCoverage] +[PathToolRequirement(PwshPathExecutable)] +public partial class PwshTasks + : IRequirePathTool +{ + public const string PwshPathExecutable = "pwsh"; + /// + /// Path to the Pwsh executable. + /// + public static string PwshPath => + ToolPathResolver.TryGetEnvironmentExecutable("PWSH_EXE") ?? + ToolPathResolver.GetPathExecutable("pwsh"); + public static Action PwshLogger { get; set; } = ProcessTasks.DefaultLogger; + /// + ///

    PowerShell is a cross-platform task automation solution made up of a command-line shell, a scripting language, and a configuration management framework. PowerShell runs on Windows, Linux, and macOS.

    + ///

    For more details, visit the official website.

    + ///
    + public static IReadOnlyCollection Pwsh(ref ArgumentStringHandler arguments, string workingDirectory = null, IReadOnlyDictionary environmentVariables = null, int? timeout = null, bool? logOutput = null, bool? logInvocation = null, Action customLogger = null) + { + using var process = ProcessTasks.StartProcess(PwshPath, ref arguments, workingDirectory, environmentVariables, timeout, logOutput, logInvocation, customLogger ?? PwshLogger); + process.AssertZeroExitCode(); + return process.Output; + } + /// + ///

    PowerShell is a cross-platform task automation solution made up of a command-line shell, a scripting language, and a configuration management framework. PowerShell runs on Windows, Linux, and macOS.

    + ///

    For more details, visit the official website.

    + ///
    + /// + ///

    This is a CLI wrapper with fluent API that allows to modify the following arguments:

    + ///
      + ///
    • <fileArguments> via
    • + ///
    • -Command via
    • + ///
    • -ConfigurationFile via
    • + ///
    • -ConfigurationName via
    • + ///
    • -CustomPipeName via
    • + ///
    • -EncodedCommand via
    • + ///
    • -ExecutionPolicy via
    • + ///
    • -File via
    • + ///
    • -InputFormat via
    • + ///
    • -Interactive via
    • + ///
    • -Login via
    • + ///
    • -Mta via
    • + ///
    • -NoExit via
    • + ///
    • -NoLogo via
    • + ///
    • -NonInteractive via
    • + ///
    • -NoProfile via
    • + ///
    • -NoProfileLoadTime via
    • + ///
    • -OutputFormat via
    • + ///
    • -SettingsFile via
    • + ///
    • -SSHServerMode via
    • + ///
    • -Sta via
    • + ///
    • -Version via
    • + ///
    • -WindowStyle via
    • + ///
    • -WorkingDirectory via
    • + ///
    + ///
    + public static IReadOnlyCollection Pwsh(PwshSettings toolSettings = null) + { + toolSettings = toolSettings ?? new PwshSettings(); + using var process = ProcessTasks.StartProcess(toolSettings); + process.AssertZeroExitCode(); + return process.Output; + } + /// + ///

    PowerShell is a cross-platform task automation solution made up of a command-line shell, a scripting language, and a configuration management framework. PowerShell runs on Windows, Linux, and macOS.

    + ///

    For more details, visit the official website.

    + ///
    + /// + ///

    This is a CLI wrapper with fluent API that allows to modify the following arguments:

    + ///
      + ///
    • <fileArguments> via
    • + ///
    • -Command via
    • + ///
    • -ConfigurationFile via
    • + ///
    • -ConfigurationName via
    • + ///
    • -CustomPipeName via
    • + ///
    • -EncodedCommand via
    • + ///
    • -ExecutionPolicy via
    • + ///
    • -File via
    • + ///
    • -InputFormat via
    • + ///
    • -Interactive via
    • + ///
    • -Login via
    • + ///
    • -Mta via
    • + ///
    • -NoExit via
    • + ///
    • -NoLogo via
    • + ///
    • -NonInteractive via
    • + ///
    • -NoProfile via
    • + ///
    • -NoProfileLoadTime via
    • + ///
    • -OutputFormat via
    • + ///
    • -SettingsFile via
    • + ///
    • -SSHServerMode via
    • + ///
    • -Sta via
    • + ///
    • -Version via
    • + ///
    • -WindowStyle via
    • + ///
    • -WorkingDirectory via
    • + ///
    + ///
    + public static IReadOnlyCollection Pwsh(Configure configurator) + { + return Pwsh(configurator(new PwshSettings())); + } + /// + ///

    PowerShell is a cross-platform task automation solution made up of a command-line shell, a scripting language, and a configuration management framework. PowerShell runs on Windows, Linux, and macOS.

    + ///

    For more details, visit the official website.

    + ///
    + /// + ///

    This is a CLI wrapper with fluent API that allows to modify the following arguments:

    + ///
      + ///
    • <fileArguments> via
    • + ///
    • -Command via
    • + ///
    • -ConfigurationFile via
    • + ///
    • -ConfigurationName via
    • + ///
    • -CustomPipeName via
    • + ///
    • -EncodedCommand via
    • + ///
    • -ExecutionPolicy via
    • + ///
    • -File via
    • + ///
    • -InputFormat via
    • + ///
    • -Interactive via
    • + ///
    • -Login via
    • + ///
    • -Mta via
    • + ///
    • -NoExit via
    • + ///
    • -NoLogo via
    • + ///
    • -NonInteractive via
    • + ///
    • -NoProfile via
    • + ///
    • -NoProfileLoadTime via
    • + ///
    • -OutputFormat via
    • + ///
    • -SettingsFile via
    • + ///
    • -SSHServerMode via
    • + ///
    • -Sta via
    • + ///
    • -Version via
    • + ///
    • -WindowStyle via
    • + ///
    • -WorkingDirectory via
    • + ///
    + ///
    + public static IEnumerable<(PwshSettings Settings, IReadOnlyCollection Output)> Pwsh(CombinatorialConfigure configurator, int degreeOfParallelism = 1, bool completeOnFailure = false) + { + return configurator.Invoke(Pwsh, PwshLogger, degreeOfParallelism, completeOnFailure); + } +} +#region PwshSettings +/// +/// Used within . +/// +[PublicAPI] +[ExcludeFromCodeCoverage] +[Serializable] +public partial class PwshSettings : ToolSettings +{ + /// + /// Path to the Pwsh executable. + /// + public override string ProcessToolPath => base.ProcessToolPath ?? PwshTasks.PwshPath; + public override Action ProcessCustomLogger => base.ProcessCustomLogger ?? PwshTasks.PwshLogger; + /// + /// Displays the version of PowerShell. Additional parameters are ignored. + /// + public virtual bool? Version { get; internal set; } + /// + /// Hides the copyright banner at startup. + /// + public virtual bool? NoLogo { get; internal set; } + /// + /// Does not exit after running startup commands. + /// + public virtual bool? NoExit { get; internal set; } + /// + /// Start PowerShell using a single-threaded apartment. This is the default. This switch is only available on the Windows platform. + /// + public virtual bool? SingleThreadedApartment { get; internal set; } + /// + /// Start PowerShell using a multi-threaded apartment. This switch is only available on Windows. + /// + public virtual bool? MultiThreadedApartment { get; internal set; } + /// + /// Does not load the PowerShell profile. + /// + public virtual bool? NoProfile { get; internal set; } + /// + /// Hides the PowerShell profile load time text shown at startup when the load time exceeds 500 milliseconds. + /// + public virtual bool? NoProfileLoadTime { get; internal set; } + /// + /// This switch is used to create sessions that shouldn't require user input. This is useful for scripts that run in scheduled tasks or CI/CD pipelines. Any attempts to use interactive features, like Read-Host or confirmation prompts, result in statement terminating errors rather than hanging. + /// + public virtual bool? NonInteractive { get; internal set; } + /// + /// Present an interactive prompt to the user. Inverse for NonInteractive parameter. + /// + public virtual bool? Interactive { get; internal set; } + /// + /// Describes the format of data sent to PowerShell. Valid values are Text (text strings) or XML (serialized CLIXML format). + /// + public virtual PwshInOutFormat InputFormat { get; internal set; } + /// + /// Determines how output from PowerShell is formatted. Valid values are Text (text strings) or XML (serialized CLIXML format). + /// + public virtual PwshInOutFormat OutputFormat { get; internal set; } + /// + /// Sets the window style for the session. Valid values are Normal, Minimized, Maximized and Hidden. + /// + public virtual PwshWindowStyle WindowStyle { get; internal set; } + /// + /// Accepts a base-64-encoded string version of a command. Use this parameter to submit commands to PowerShell that require complex quotation marks or curly braces. The string must be formatted using UTF-16LE character encoding. + /// + public virtual string EncodedCommand { get; internal set; } + /// + /// Specifies a configuration endpoint in which PowerShell is run. This can be any endpoint registered on the local machine including the default PowerShell remoting endpoints or a custom endpoint having specific user role capabilities. + /// + public virtual string ConfigurationName { get; internal set; } + /// + /// Sets the default execution policy for the current session and saves it in the $env:PSExecutionPolicyPreference environment variable. This parameter does not change the PowerShell execution policy that is set in the registry. This parameter only applies to Windows computers. The $env:PSExecutionPolicyPreference environment variable does not exist on non-Windows platforms. + /// + public virtual PwshExecutionPolicy ExecutionPolicy { get; internal set; } + /// + /// If the value of File is -, the command text is read from standard input. Running pwsh -File - without redirected standard input starts a regular session. This is the same as not specifying the File parameter at all.This is the default parameter if no parameters are present but values are present in the command line. The specified script runs in the local scope ("dot-sourced"), so that the functions and variables that the script creates are available in the current session. Enter the script file path and any parameters. File must be the last parameter in the command, because all characters typed after the File parameter name are interpreted as the script file path followed by the script parameters. + /// + public virtual string File { get; internal set; } + /// + /// Arguments passed in when using the -File option. + /// + public virtual IReadOnlyList FileArguments => FileArgumentsInternal.AsReadOnly(); + internal List FileArgumentsInternal { get; set; } = new List(); + /// + /// Executes the specified commands (and any parameters) as though they were typed at the PowerShell command prompt, and then exits, unless the NoExit parameter is specified.The value of Command can be -, a script block, or a string. If the value of Command is -, the command text is read from standard input.The Command parameter only accepts a script block for execution when it can recognize the value passed to Command as a ScriptBlock type. This is only possible when running pwsh from another PowerShell host. The ScriptBlock type may be contained in an existing variable, returned from an expression, or parsed by the PowerShell host as a literal script block enclosed in curly braces ({}), before being passed to pwsh. + /// + public virtual string Command { get; internal set; } + /// + /// Overrides the system-wide powershell.config.json settings file for the session. By default, system-wide settings are read from the powershell.config.json in the $PSHOME directory. Note that these settings are not used by the endpoint specified by the -ConfigurationName argument. + /// + public virtual string SettingsFile { get; internal set; } + /// + /// Specifies the name to use for an additional IPC server (named pipe) used for debugging and other cross-process communication. This offers a predictable mechanism for connecting to other PowerShell instances. Typically used with the CustomPipeName parameter on Enter-PSHostProcess. This parameter was introduced in PowerShell 6.2. + /// + public virtual string CustomPipeName { get; internal set; } + /// + /// Used in sshd_config for running PowerShell as an SSH subsystem. It is not intended or supported for any other use. + /// + public virtual bool? SSHServerMode { get; internal set; } + /// + /// Sets the initial working directory by executing at startup. Any valid PowerShell file path is supported. To start PowerShell in your home directory, use: pwsh -WorkingDirectory ~ + /// + public virtual string WorkingDirectory { get; internal set; } + /// + /// Specifies a session configuration (.pssc) file path. The configuration contained in the configuration file will be applied to the PowerShell session. + /// + public virtual string ConfigurationFile { get; internal set; } + /// + /// On Linux and macOS, starts PowerShell as a login shell, using /bin/sh to execute login profiles such as /etc/profile and ~/.profile. On Windows, this switch does nothing. IMPORTANT This parameter must come first to start PowerShell as a login shell. Passing this parameter in another position will be ignored. + /// + public virtual bool? Login { get; internal set; } + protected override Arguments ConfigureProcessArguments(Arguments arguments) + { + arguments + .Add("-Version", Version) + .Add("-NoLogo", NoLogo) + .Add("-NoExit", NoExit) + .Add("-Sta", SingleThreadedApartment) + .Add("-Mta", MultiThreadedApartment) + .Add("-NoProfile", NoProfile) + .Add("-NoProfileLoadTime", NoProfileLoadTime) + .Add("-NonInteractive", NonInteractive) + .Add("-Interactive", Interactive) + .Add("-InputFormat {value}", InputFormat) + .Add("-OutputFormat {value}", OutputFormat) + .Add("-WindowStyle {value}", WindowStyle) + .Add("-EncodedCommand {value}", EncodedCommand) + .Add("-ConfigurationName {value}", ConfigurationName) + .Add("-ExecutionPolicy {value}", ExecutionPolicy) + .Add("-File {value}", File) + .Add("{value}", FileArguments) + .Add("-Command {value}", Command) + .Add("-SettingsFile {value}", SettingsFile) + .Add("-CustomPipeName {value}", CustomPipeName) + .Add("-SSHServerMode", SSHServerMode) + .Add("-WorkingDirectory {value}", WorkingDirectory) + .Add("-ConfigurationFile {value}", ConfigurationFile) + .Add("-Login", Login); + return base.ConfigureProcessArguments(arguments); + } +} +#endregion +#region PwshSettingsExtensions +/// +/// Used within . +/// +[PublicAPI] +[ExcludeFromCodeCoverage] +public static partial class PwshSettingsExtensions +{ + #region Version + /// + ///

    Sets

    + ///

    Displays the version of PowerShell. Additional parameters are ignored.

    + ///
    + [Pure] + public static T SetVersion(this T toolSettings, bool? version) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Version = version; + return toolSettings; + } + /// + ///

    Resets

    + ///

    Displays the version of PowerShell. Additional parameters are ignored.

    + ///
    + [Pure] + public static T ResetVersion(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Version = null; + return toolSettings; + } + /// + ///

    Enables

    + ///

    Displays the version of PowerShell. Additional parameters are ignored.

    + ///
    + [Pure] + public static T EnableVersion(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Version = true; + return toolSettings; + } + /// + ///

    Disables

    + ///

    Displays the version of PowerShell. Additional parameters are ignored.

    + ///
    + [Pure] + public static T DisableVersion(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Version = false; + return toolSettings; + } + /// + ///

    Toggles

    + ///

    Displays the version of PowerShell. Additional parameters are ignored.

    + ///
    + [Pure] + public static T ToggleVersion(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Version = !toolSettings.Version; + return toolSettings; + } + #endregion + #region NoLogo + /// + ///

    Sets

    + ///

    Hides the copyright banner at startup.

    + ///
    + [Pure] + public static T SetNoLogo(this T toolSettings, bool? noLogo) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoLogo = noLogo; + return toolSettings; + } + /// + ///

    Resets

    + ///

    Hides the copyright banner at startup.

    + ///
    + [Pure] + public static T ResetNoLogo(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoLogo = null; + return toolSettings; + } + /// + ///

    Enables

    + ///

    Hides the copyright banner at startup.

    + ///
    + [Pure] + public static T EnableNoLogo(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoLogo = true; + return toolSettings; + } + /// + ///

    Disables

    + ///

    Hides the copyright banner at startup.

    + ///
    + [Pure] + public static T DisableNoLogo(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoLogo = false; + return toolSettings; + } + /// + ///

    Toggles

    + ///

    Hides the copyright banner at startup.

    + ///
    + [Pure] + public static T ToggleNoLogo(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoLogo = !toolSettings.NoLogo; + return toolSettings; + } + #endregion + #region NoExit + /// + ///

    Sets

    + ///

    Does not exit after running startup commands.

    + ///
    + [Pure] + public static T SetNoExit(this T toolSettings, bool? noExit) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoExit = noExit; + return toolSettings; + } + /// + ///

    Resets

    + ///

    Does not exit after running startup commands.

    + ///
    + [Pure] + public static T ResetNoExit(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoExit = null; + return toolSettings; + } + /// + ///

    Enables

    + ///

    Does not exit after running startup commands.

    + ///
    + [Pure] + public static T EnableNoExit(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoExit = true; + return toolSettings; + } + /// + ///

    Disables

    + ///

    Does not exit after running startup commands.

    + ///
    + [Pure] + public static T DisableNoExit(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoExit = false; + return toolSettings; + } + /// + ///

    Toggles

    + ///

    Does not exit after running startup commands.

    + ///
    + [Pure] + public static T ToggleNoExit(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoExit = !toolSettings.NoExit; + return toolSettings; + } + #endregion + #region SingleThreadedApartment + /// + ///

    Sets

    + ///

    Start PowerShell using a single-threaded apartment. This is the default. This switch is only available on the Windows platform.

    + ///
    + [Pure] + public static T SetSingleThreadedApartment(this T toolSettings, bool? singleThreadedApartment) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.SingleThreadedApartment = singleThreadedApartment; + return toolSettings; + } + /// + ///

    Resets

    + ///

    Start PowerShell using a single-threaded apartment. This is the default. This switch is only available on the Windows platform.

    + ///
    + [Pure] + public static T ResetSingleThreadedApartment(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.SingleThreadedApartment = null; + return toolSettings; + } + /// + ///

    Enables

    + ///

    Start PowerShell using a single-threaded apartment. This is the default. This switch is only available on the Windows platform.

    + ///
    + [Pure] + public static T EnableSingleThreadedApartment(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.SingleThreadedApartment = true; + return toolSettings; + } + /// + ///

    Disables

    + ///

    Start PowerShell using a single-threaded apartment. This is the default. This switch is only available on the Windows platform.

    + ///
    + [Pure] + public static T DisableSingleThreadedApartment(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.SingleThreadedApartment = false; + return toolSettings; + } + /// + ///

    Toggles

    + ///

    Start PowerShell using a single-threaded apartment. This is the default. This switch is only available on the Windows platform.

    + ///
    + [Pure] + public static T ToggleSingleThreadedApartment(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.SingleThreadedApartment = !toolSettings.SingleThreadedApartment; + return toolSettings; + } + #endregion + #region MultiThreadedApartment + /// + ///

    Sets

    + ///

    Start PowerShell using a multi-threaded apartment. This switch is only available on Windows.

    + ///
    + [Pure] + public static T SetMultiThreadedApartment(this T toolSettings, bool? multiThreadedApartment) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.MultiThreadedApartment = multiThreadedApartment; + return toolSettings; + } + /// + ///

    Resets

    + ///

    Start PowerShell using a multi-threaded apartment. This switch is only available on Windows.

    + ///
    + [Pure] + public static T ResetMultiThreadedApartment(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.MultiThreadedApartment = null; + return toolSettings; + } + /// + ///

    Enables

    + ///

    Start PowerShell using a multi-threaded apartment. This switch is only available on Windows.

    + ///
    + [Pure] + public static T EnableMultiThreadedApartment(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.MultiThreadedApartment = true; + return toolSettings; + } + /// + ///

    Disables

    + ///

    Start PowerShell using a multi-threaded apartment. This switch is only available on Windows.

    + ///
    + [Pure] + public static T DisableMultiThreadedApartment(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.MultiThreadedApartment = false; + return toolSettings; + } + /// + ///

    Toggles

    + ///

    Start PowerShell using a multi-threaded apartment. This switch is only available on Windows.

    + ///
    + [Pure] + public static T ToggleMultiThreadedApartment(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.MultiThreadedApartment = !toolSettings.MultiThreadedApartment; + return toolSettings; + } + #endregion + #region NoProfile + /// + ///

    Sets

    + ///

    Does not load the PowerShell profile.

    + ///
    + [Pure] + public static T SetNoProfile(this T toolSettings, bool? noProfile) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoProfile = noProfile; + return toolSettings; + } + /// + ///

    Resets

    + ///

    Does not load the PowerShell profile.

    + ///
    + [Pure] + public static T ResetNoProfile(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoProfile = null; + return toolSettings; + } + /// + ///

    Enables

    + ///

    Does not load the PowerShell profile.

    + ///
    + [Pure] + public static T EnableNoProfile(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoProfile = true; + return toolSettings; + } + /// + ///

    Disables

    + ///

    Does not load the PowerShell profile.

    + ///
    + [Pure] + public static T DisableNoProfile(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoProfile = false; + return toolSettings; + } + /// + ///

    Toggles

    + ///

    Does not load the PowerShell profile.

    + ///
    + [Pure] + public static T ToggleNoProfile(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoProfile = !toolSettings.NoProfile; + return toolSettings; + } + #endregion + #region NoProfileLoadTime + /// + ///

    Sets

    + ///

    Hides the PowerShell profile load time text shown at startup when the load time exceeds 500 milliseconds.

    + ///
    + [Pure] + public static T SetNoProfileLoadTime(this T toolSettings, bool? noProfileLoadTime) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoProfileLoadTime = noProfileLoadTime; + return toolSettings; + } + /// + ///

    Resets

    + ///

    Hides the PowerShell profile load time text shown at startup when the load time exceeds 500 milliseconds.

    + ///
    + [Pure] + public static T ResetNoProfileLoadTime(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoProfileLoadTime = null; + return toolSettings; + } + /// + ///

    Enables

    + ///

    Hides the PowerShell profile load time text shown at startup when the load time exceeds 500 milliseconds.

    + ///
    + [Pure] + public static T EnableNoProfileLoadTime(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoProfileLoadTime = true; + return toolSettings; + } + /// + ///

    Disables

    + ///

    Hides the PowerShell profile load time text shown at startup when the load time exceeds 500 milliseconds.

    + ///
    + [Pure] + public static T DisableNoProfileLoadTime(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoProfileLoadTime = false; + return toolSettings; + } + /// + ///

    Toggles

    + ///

    Hides the PowerShell profile load time text shown at startup when the load time exceeds 500 milliseconds.

    + ///
    + [Pure] + public static T ToggleNoProfileLoadTime(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NoProfileLoadTime = !toolSettings.NoProfileLoadTime; + return toolSettings; + } + #endregion + #region NonInteractive + /// + ///

    Sets

    + ///

    This switch is used to create sessions that shouldn't require user input. This is useful for scripts that run in scheduled tasks or CI/CD pipelines. Any attempts to use interactive features, like Read-Host or confirmation prompts, result in statement terminating errors rather than hanging.

    + ///
    + [Pure] + public static T SetNonInteractive(this T toolSettings, bool? nonInteractive) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NonInteractive = nonInteractive; + return toolSettings; + } + /// + ///

    Resets

    + ///

    This switch is used to create sessions that shouldn't require user input. This is useful for scripts that run in scheduled tasks or CI/CD pipelines. Any attempts to use interactive features, like Read-Host or confirmation prompts, result in statement terminating errors rather than hanging.

    + ///
    + [Pure] + public static T ResetNonInteractive(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NonInteractive = null; + return toolSettings; + } + /// + ///

    Enables

    + ///

    This switch is used to create sessions that shouldn't require user input. This is useful for scripts that run in scheduled tasks or CI/CD pipelines. Any attempts to use interactive features, like Read-Host or confirmation prompts, result in statement terminating errors rather than hanging.

    + ///
    + [Pure] + public static T EnableNonInteractive(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NonInteractive = true; + return toolSettings; + } + /// + ///

    Disables

    + ///

    This switch is used to create sessions that shouldn't require user input. This is useful for scripts that run in scheduled tasks or CI/CD pipelines. Any attempts to use interactive features, like Read-Host or confirmation prompts, result in statement terminating errors rather than hanging.

    + ///
    + [Pure] + public static T DisableNonInteractive(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NonInteractive = false; + return toolSettings; + } + /// + ///

    Toggles

    + ///

    This switch is used to create sessions that shouldn't require user input. This is useful for scripts that run in scheduled tasks or CI/CD pipelines. Any attempts to use interactive features, like Read-Host or confirmation prompts, result in statement terminating errors rather than hanging.

    + ///
    + [Pure] + public static T ToggleNonInteractive(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.NonInteractive = !toolSettings.NonInteractive; + return toolSettings; + } + #endregion + #region Interactive + /// + ///

    Sets

    + ///

    Present an interactive prompt to the user. Inverse for NonInteractive parameter.

    + ///
    + [Pure] + public static T SetInteractive(this T toolSettings, bool? interactive) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Interactive = interactive; + return toolSettings; + } + /// + ///

    Resets

    + ///

    Present an interactive prompt to the user. Inverse for NonInteractive parameter.

    + ///
    + [Pure] + public static T ResetInteractive(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Interactive = null; + return toolSettings; + } + /// + ///

    Enables

    + ///

    Present an interactive prompt to the user. Inverse for NonInteractive parameter.

    + ///
    + [Pure] + public static T EnableInteractive(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Interactive = true; + return toolSettings; + } + /// + ///

    Disables

    + ///

    Present an interactive prompt to the user. Inverse for NonInteractive parameter.

    + ///
    + [Pure] + public static T DisableInteractive(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Interactive = false; + return toolSettings; + } + /// + ///

    Toggles

    + ///

    Present an interactive prompt to the user. Inverse for NonInteractive parameter.

    + ///
    + [Pure] + public static T ToggleInteractive(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Interactive = !toolSettings.Interactive; + return toolSettings; + } + #endregion + #region InputFormat + /// + ///

    Sets

    + ///

    Describes the format of data sent to PowerShell. Valid values are Text (text strings) or XML (serialized CLIXML format).

    + ///
    + [Pure] + public static T SetInputFormat(this T toolSettings, PwshInOutFormat inputFormat) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.InputFormat = inputFormat; + return toolSettings; + } + /// + ///

    Resets

    + ///

    Describes the format of data sent to PowerShell. Valid values are Text (text strings) or XML (serialized CLIXML format).

    + ///
    + [Pure] + public static T ResetInputFormat(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.InputFormat = null; + return toolSettings; + } + #endregion + #region OutputFormat + /// + ///

    Sets

    + ///

    Determines how output from PowerShell is formatted. Valid values are Text (text strings) or XML (serialized CLIXML format).

    + ///
    + [Pure] + public static T SetOutputFormat(this T toolSettings, PwshInOutFormat outputFormat) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.OutputFormat = outputFormat; + return toolSettings; + } + /// + ///

    Resets

    + ///

    Determines how output from PowerShell is formatted. Valid values are Text (text strings) or XML (serialized CLIXML format).

    + ///
    + [Pure] + public static T ResetOutputFormat(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.OutputFormat = null; + return toolSettings; + } + #endregion + #region WindowStyle + /// + ///

    Sets

    + ///

    Sets the window style for the session. Valid values are Normal, Minimized, Maximized and Hidden.

    + ///
    + [Pure] + public static T SetWindowStyle(this T toolSettings, PwshWindowStyle windowStyle) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.WindowStyle = windowStyle; + return toolSettings; + } + /// + ///

    Resets

    + ///

    Sets the window style for the session. Valid values are Normal, Minimized, Maximized and Hidden.

    + ///
    + [Pure] + public static T ResetWindowStyle(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.WindowStyle = null; + return toolSettings; + } + #endregion + #region EncodedCommand + /// + ///

    Sets

    + ///

    Accepts a base-64-encoded string version of a command. Use this parameter to submit commands to PowerShell that require complex quotation marks or curly braces. The string must be formatted using UTF-16LE character encoding.

    + ///
    + [Pure] + public static T SetEncodedCommand(this T toolSettings, string encodedCommand) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.EncodedCommand = encodedCommand; + return toolSettings; + } + /// + ///

    Resets

    + ///

    Accepts a base-64-encoded string version of a command. Use this parameter to submit commands to PowerShell that require complex quotation marks or curly braces. The string must be formatted using UTF-16LE character encoding.

    + ///
    + [Pure] + public static T ResetEncodedCommand(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.EncodedCommand = null; + return toolSettings; + } + #endregion + #region ConfigurationName + /// + ///

    Sets

    + ///

    Specifies a configuration endpoint in which PowerShell is run. This can be any endpoint registered on the local machine including the default PowerShell remoting endpoints or a custom endpoint having specific user role capabilities.

    + ///
    + [Pure] + public static T SetConfigurationName(this T toolSettings, string configurationName) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ConfigurationName = configurationName; + return toolSettings; + } + /// + ///

    Resets

    + ///

    Specifies a configuration endpoint in which PowerShell is run. This can be any endpoint registered on the local machine including the default PowerShell remoting endpoints or a custom endpoint having specific user role capabilities.

    + ///
    + [Pure] + public static T ResetConfigurationName(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ConfigurationName = null; + return toolSettings; + } + #endregion + #region ExecutionPolicy + /// + ///

    Sets

    + ///

    Sets the default execution policy for the current session and saves it in the $env:PSExecutionPolicyPreference environment variable. This parameter does not change the PowerShell execution policy that is set in the registry. This parameter only applies to Windows computers. The $env:PSExecutionPolicyPreference environment variable does not exist on non-Windows platforms.

    + ///
    + [Pure] + public static T SetExecutionPolicy(this T toolSettings, PwshExecutionPolicy executionPolicy) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ExecutionPolicy = executionPolicy; + return toolSettings; + } + /// + ///

    Resets

    + ///

    Sets the default execution policy for the current session and saves it in the $env:PSExecutionPolicyPreference environment variable. This parameter does not change the PowerShell execution policy that is set in the registry. This parameter only applies to Windows computers. The $env:PSExecutionPolicyPreference environment variable does not exist on non-Windows platforms.

    + ///
    + [Pure] + public static T ResetExecutionPolicy(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ExecutionPolicy = null; + return toolSettings; + } + #endregion + #region File + /// + ///

    Sets

    + ///

    If the value of File is -, the command text is read from standard input. Running pwsh -File - without redirected standard input starts a regular session. This is the same as not specifying the File parameter at all.This is the default parameter if no parameters are present but values are present in the command line. The specified script runs in the local scope ("dot-sourced"), so that the functions and variables that the script creates are available in the current session. Enter the script file path and any parameters. File must be the last parameter in the command, because all characters typed after the File parameter name are interpreted as the script file path followed by the script parameters.

    + ///
    + [Pure] + public static T SetFile(this T toolSettings, string file) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.File = file; + return toolSettings; + } + /// + ///

    Resets

    + ///

    If the value of File is -, the command text is read from standard input. Running pwsh -File - without redirected standard input starts a regular session. This is the same as not specifying the File parameter at all.This is the default parameter if no parameters are present but values are present in the command line. The specified script runs in the local scope ("dot-sourced"), so that the functions and variables that the script creates are available in the current session. Enter the script file path and any parameters. File must be the last parameter in the command, because all characters typed after the File parameter name are interpreted as the script file path followed by the script parameters.

    + ///
    + [Pure] + public static T ResetFile(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.File = null; + return toolSettings; + } + #endregion + #region FileArguments + /// + ///

    Sets to a new list

    + ///

    Arguments passed in when using the -File option.

    + ///
    + [Pure] + public static T SetFileArguments(this T toolSettings, params string[] fileArguments) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.FileArgumentsInternal = fileArguments.ToList(); + return toolSettings; + } + /// + ///

    Sets to a new list

    + ///

    Arguments passed in when using the -File option.

    + ///
    + [Pure] + public static T SetFileArguments(this T toolSettings, IEnumerable fileArguments) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.FileArgumentsInternal = fileArguments.ToList(); + return toolSettings; + } + /// + ///

    Adds values to

    + ///

    Arguments passed in when using the -File option.

    + ///
    + [Pure] + public static T AddFileArguments(this T toolSettings, params string[] fileArguments) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.FileArgumentsInternal.AddRange(fileArguments); + return toolSettings; + } + /// + ///

    Adds values to

    + ///

    Arguments passed in when using the -File option.

    + ///
    + [Pure] + public static T AddFileArguments(this T toolSettings, IEnumerable fileArguments) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.FileArgumentsInternal.AddRange(fileArguments); + return toolSettings; + } + /// + ///

    Clears

    + ///

    Arguments passed in when using the -File option.

    + ///
    + [Pure] + public static T ClearFileArguments(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.FileArgumentsInternal.Clear(); + return toolSettings; + } + /// + ///

    Removes values from

    + ///

    Arguments passed in when using the -File option.

    + ///
    + [Pure] + public static T RemoveFileArguments(this T toolSettings, params string[] fileArguments) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + var hashSet = new HashSet(fileArguments); + toolSettings.FileArgumentsInternal.RemoveAll(x => hashSet.Contains(x)); + return toolSettings; + } + /// + ///

    Removes values from

    + ///

    Arguments passed in when using the -File option.

    + ///
    + [Pure] + public static T RemoveFileArguments(this T toolSettings, IEnumerable fileArguments) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + var hashSet = new HashSet(fileArguments); + toolSettings.FileArgumentsInternal.RemoveAll(x => hashSet.Contains(x)); + return toolSettings; + } + #endregion + #region Command + /// + ///

    Sets

    + ///

    Executes the specified commands (and any parameters) as though they were typed at the PowerShell command prompt, and then exits, unless the NoExit parameter is specified.The value of Command can be -, a script block, or a string. If the value of Command is -, the command text is read from standard input.The Command parameter only accepts a script block for execution when it can recognize the value passed to Command as a ScriptBlock type. This is only possible when running pwsh from another PowerShell host. The ScriptBlock type may be contained in an existing variable, returned from an expression, or parsed by the PowerShell host as a literal script block enclosed in curly braces ({}), before being passed to pwsh.

    + ///
    + [Pure] + public static T SetCommand(this T toolSettings, string command) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Command = command; + return toolSettings; + } + /// + ///

    Resets

    + ///

    Executes the specified commands (and any parameters) as though they were typed at the PowerShell command prompt, and then exits, unless the NoExit parameter is specified.The value of Command can be -, a script block, or a string. If the value of Command is -, the command text is read from standard input.The Command parameter only accepts a script block for execution when it can recognize the value passed to Command as a ScriptBlock type. This is only possible when running pwsh from another PowerShell host. The ScriptBlock type may be contained in an existing variable, returned from an expression, or parsed by the PowerShell host as a literal script block enclosed in curly braces ({}), before being passed to pwsh.

    + ///
    + [Pure] + public static T ResetCommand(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Command = null; + return toolSettings; + } + #endregion + #region SettingsFile + /// + ///

    Sets

    + ///

    Overrides the system-wide powershell.config.json settings file for the session. By default, system-wide settings are read from the powershell.config.json in the $PSHOME directory. Note that these settings are not used by the endpoint specified by the -ConfigurationName argument.

    + ///
    + [Pure] + public static T SetSettingsFile(this T toolSettings, string settingsFile) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.SettingsFile = settingsFile; + return toolSettings; + } + /// + ///

    Resets

    + ///

    Overrides the system-wide powershell.config.json settings file for the session. By default, system-wide settings are read from the powershell.config.json in the $PSHOME directory. Note that these settings are not used by the endpoint specified by the -ConfigurationName argument.

    + ///
    + [Pure] + public static T ResetSettingsFile(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.SettingsFile = null; + return toolSettings; + } + #endregion + #region CustomPipeName + /// + ///

    Sets

    + ///

    Specifies the name to use for an additional IPC server (named pipe) used for debugging and other cross-process communication. This offers a predictable mechanism for connecting to other PowerShell instances. Typically used with the CustomPipeName parameter on Enter-PSHostProcess. This parameter was introduced in PowerShell 6.2.

    + ///
    + [Pure] + public static T SetCustomPipeName(this T toolSettings, string customPipeName) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.CustomPipeName = customPipeName; + return toolSettings; + } + /// + ///

    Resets

    + ///

    Specifies the name to use for an additional IPC server (named pipe) used for debugging and other cross-process communication. This offers a predictable mechanism for connecting to other PowerShell instances. Typically used with the CustomPipeName parameter on Enter-PSHostProcess. This parameter was introduced in PowerShell 6.2.

    + ///
    + [Pure] + public static T ResetCustomPipeName(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.CustomPipeName = null; + return toolSettings; + } + #endregion + #region SSHServerMode + /// + ///

    Sets

    + ///

    Used in sshd_config for running PowerShell as an SSH subsystem. It is not intended or supported for any other use.

    + ///
    + [Pure] + public static T SetSSHServerMode(this T toolSettings, bool? sshserverMode) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.SSHServerMode = sshserverMode; + return toolSettings; + } + /// + ///

    Resets

    + ///

    Used in sshd_config for running PowerShell as an SSH subsystem. It is not intended or supported for any other use.

    + ///
    + [Pure] + public static T ResetSSHServerMode(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.SSHServerMode = null; + return toolSettings; + } + /// + ///

    Enables

    + ///

    Used in sshd_config for running PowerShell as an SSH subsystem. It is not intended or supported for any other use.

    + ///
    + [Pure] + public static T EnableSSHServerMode(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.SSHServerMode = true; + return toolSettings; + } + /// + ///

    Disables

    + ///

    Used in sshd_config for running PowerShell as an SSH subsystem. It is not intended or supported for any other use.

    + ///
    + [Pure] + public static T DisableSSHServerMode(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.SSHServerMode = false; + return toolSettings; + } + /// + ///

    Toggles

    + ///

    Used in sshd_config for running PowerShell as an SSH subsystem. It is not intended or supported for any other use.

    + ///
    + [Pure] + public static T ToggleSSHServerMode(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.SSHServerMode = !toolSettings.SSHServerMode; + return toolSettings; + } + #endregion + #region WorkingDirectory + /// + ///

    Sets

    + ///

    Sets the initial working directory by executing at startup. Any valid PowerShell file path is supported. To start PowerShell in your home directory, use: pwsh -WorkingDirectory ~

    + ///
    + [Pure] + public static T SetWorkingDirectory(this T toolSettings, string workingDirectory) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.WorkingDirectory = workingDirectory; + return toolSettings; + } + /// + ///

    Resets

    + ///

    Sets the initial working directory by executing at startup. Any valid PowerShell file path is supported. To start PowerShell in your home directory, use: pwsh -WorkingDirectory ~

    + ///
    + [Pure] + public static T ResetWorkingDirectory(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.WorkingDirectory = null; + return toolSettings; + } + #endregion + #region ConfigurationFile + /// + ///

    Sets

    + ///

    Specifies a session configuration (.pssc) file path. The configuration contained in the configuration file will be applied to the PowerShell session.

    + ///
    + [Pure] + public static T SetConfigurationFile(this T toolSettings, string configurationFile) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ConfigurationFile = configurationFile; + return toolSettings; + } + /// + ///

    Resets

    + ///

    Specifies a session configuration (.pssc) file path. The configuration contained in the configuration file will be applied to the PowerShell session.

    + ///
    + [Pure] + public static T ResetConfigurationFile(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ConfigurationFile = null; + return toolSettings; + } + #endregion + #region Login + /// + ///

    Sets

    + ///

    On Linux and macOS, starts PowerShell as a login shell, using /bin/sh to execute login profiles such as /etc/profile and ~/.profile. On Windows, this switch does nothing. IMPORTANT This parameter must come first to start PowerShell as a login shell. Passing this parameter in another position will be ignored.

    + ///
    + [Pure] + public static T SetLogin(this T toolSettings, bool? login) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Login = login; + return toolSettings; + } + /// + ///

    Resets

    + ///

    On Linux and macOS, starts PowerShell as a login shell, using /bin/sh to execute login profiles such as /etc/profile and ~/.profile. On Windows, this switch does nothing. IMPORTANT This parameter must come first to start PowerShell as a login shell. Passing this parameter in another position will be ignored.

    + ///
    + [Pure] + public static T ResetLogin(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Login = null; + return toolSettings; + } + /// + ///

    Enables

    + ///

    On Linux and macOS, starts PowerShell as a login shell, using /bin/sh to execute login profiles such as /etc/profile and ~/.profile. On Windows, this switch does nothing. IMPORTANT This parameter must come first to start PowerShell as a login shell. Passing this parameter in another position will be ignored.

    + ///
    + [Pure] + public static T EnableLogin(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Login = true; + return toolSettings; + } + /// + ///

    Disables

    + ///

    On Linux and macOS, starts PowerShell as a login shell, using /bin/sh to execute login profiles such as /etc/profile and ~/.profile. On Windows, this switch does nothing. IMPORTANT This parameter must come first to start PowerShell as a login shell. Passing this parameter in another position will be ignored.

    + ///
    + [Pure] + public static T DisableLogin(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Login = false; + return toolSettings; + } + /// + ///

    Toggles

    + ///

    On Linux and macOS, starts PowerShell as a login shell, using /bin/sh to execute login profiles such as /etc/profile and ~/.profile. On Windows, this switch does nothing. IMPORTANT This parameter must come first to start PowerShell as a login shell. Passing this parameter in another position will be ignored.

    + ///
    + [Pure] + public static T ToggleLogin(this T toolSettings) where T : PwshSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Login = !toolSettings.Login; + return toolSettings; + } + #endregion +} +#endregion +#region PwshExecutionPolicy +/// +/// Used within . +/// +[PublicAPI] +[Serializable] +[ExcludeFromCodeCoverage] +[TypeConverter(typeof(TypeConverter))] +public partial class PwshExecutionPolicy : Enumeration +{ + public static PwshExecutionPolicy AllSigned = (PwshExecutionPolicy) "AllSigned"; + public static PwshExecutionPolicy Bypass = (PwshExecutionPolicy) "Bypass"; + public static PwshExecutionPolicy Default = (PwshExecutionPolicy) "Default"; + public static PwshExecutionPolicy RemoteSigned = (PwshExecutionPolicy) "RemoteSigned"; + public static PwshExecutionPolicy Restricted = (PwshExecutionPolicy) "Restricted"; + public static PwshExecutionPolicy Undefined = (PwshExecutionPolicy) "Undefined"; + public static PwshExecutionPolicy Unrestricted = (PwshExecutionPolicy) "Unrestricted"; + public static implicit operator PwshExecutionPolicy(string value) + { + return new PwshExecutionPolicy { Value = value }; + } +} +#endregion +#region PwshInOutFormat +/// +/// Used within . +/// +[PublicAPI] +[Serializable] +[ExcludeFromCodeCoverage] +[TypeConverter(typeof(TypeConverter))] +public partial class PwshInOutFormat : Enumeration +{ + public static PwshInOutFormat Text = (PwshInOutFormat) "Text"; + public static PwshInOutFormat Xml = (PwshInOutFormat) "Xml"; + public static implicit operator PwshInOutFormat(string value) + { + return new PwshInOutFormat { Value = value }; + } +} +#endregion +#region PwshWindowStyle +/// +/// Used within . +/// +[PublicAPI] +[Serializable] +[ExcludeFromCodeCoverage] +[TypeConverter(typeof(TypeConverter))] +public partial class PwshWindowStyle : Enumeration +{ + public static PwshWindowStyle Normal = (PwshWindowStyle) "Normal"; + public static PwshWindowStyle Minimized = (PwshWindowStyle) "Minimized"; + public static PwshWindowStyle Maximized = (PwshWindowStyle) "Maximized"; + public static PwshWindowStyle Hidden = (PwshWindowStyle) "Hidden"; + public static implicit operator PwshWindowStyle(string value) + { + return new PwshWindowStyle { Value = value }; + } +} +#endregion