/********************************************************************++
Copyright (c) Microsoft Corporation. All rights reserved.
--********************************************************************/
using System.Management.Automation;
using System.Management.Automation.Runspaces;
namespace Microsoft.PowerShell
{
///
/// This class provides an entry point which is called by minishell's main
/// to transfer control to Msh console host implementation.
///
public static
class ConsoleShell
{
#if CORECLR
/// Entry point in to ConsoleShell. This method is called by main of minishell.
/// Banner text to be displayed by ConsoleHost
/// Help text for minishell. This is displayed on 'minishell -?'.
/// Commandline parameters specified by user.
/// An integer value which should be used as exit code for the process.
public static int Start(string bannerText, string helpText, string[] args)
{
return Start(null, bannerText, helpText, null, args);
}
#else
/// Entry point in to ConsoleShell. This method is called by main of minishell.
/// Configuration information which is used to create Runspace.
/// Banner text to be displayed by ConsoleHost
/// Help text for minishell. This is displayed on 'minishell -?'.
/// Commandline parameters specified by user.
/// An integer value which should be used as exit code for the process.
public static int Start(RunspaceConfiguration configuration, string bannerText, string helpText, string[] args)
{
return Start(configuration, bannerText, helpText, null, args);
}
#endif
///
///
/// Entry point in to ConsoleShell. This method is called from the native or managed exe host application
///
///
///
/// Configuration information which is used to create Runspace.
///
///
///
/// Banner text to be displayed by ConsoleHost
///
///
///
/// Help text for minishell. This is displayed on 'minishell -?'.
///
///
///
/// Warning occurred prior to this point, for example, a snap-in fails to load beforehand.
/// This string will be printed out.
///
///
///
/// Commandline parameters specified by user.
///
///
///
/// An integer value which should be used as exit code for the
/// process.
///
internal static
int
Start(RunspaceConfiguration configuration,
string bannerText,
string helpText,
string preStartWarning,
string[] args)
{
if (args == null)
{
throw PSTraceSource.NewArgumentNullException("args");
}
return ConsoleHost.Start(configuration, bannerText, helpText, preStartWarning, args);
}
}
}