forked from PowerShell/PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConsoleShell.cs
More file actions
89 lines (82 loc) · 3.49 KB
/
Copy pathConsoleShell.cs
File metadata and controls
89 lines (82 loc) · 3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/********************************************************************++
Copyright (c) Microsoft Corporation. All rights reserved.
--********************************************************************/
using System.Management.Automation;
using System.Management.Automation.Runspaces;
namespace Microsoft.PowerShell
{
/// <summary>
/// This class provides an entry point which is called by minishell's main
/// to transfer control to Msh console host implementation.
/// </summary>
public static
class ConsoleShell
{
#if CORECLR
/// <summary>Entry point in to ConsoleShell. This method is called by main of minishell.</summary>
/// <param name="bannerText">Banner text to be displayed by ConsoleHost</param>
/// <param name="helpText">Help text for minishell. This is displayed on 'minishell -?'.</param>
/// <param name="args">Commandline parameters specified by user.</param>
/// <returns>An integer value which should be used as exit code for the process.</returns>
public static int Start(string bannerText, string helpText, string[] args)
{
return Start(null, bannerText, helpText, null, args);
}
#else
/// <summary>Entry point in to ConsoleShell. This method is called by main of minishell.</summary>
/// <param name="configuration">Configuration information which is used to create Runspace.</param>
/// <param name="bannerText">Banner text to be displayed by ConsoleHost</param>
/// <param name="helpText">Help text for minishell. This is displayed on 'minishell -?'.</param>
/// <param name="args">Commandline parameters specified by user.</param>
/// <returns>An integer value which should be used as exit code for the process.</returns>
public static int Start(RunspaceConfiguration configuration, string bannerText, string helpText, string[] args)
{
return Start(configuration, bannerText, helpText, null, args);
}
#endif
/// <summary>
///
/// Entry point in to ConsoleShell. This method is called from the native or managed exe host application
///
/// </summary>
/// <param name="configuration">
/// Configuration information which is used to create Runspace.
/// </param>
///
/// <param name="bannerText">
/// Banner text to be displayed by ConsoleHost
/// </param>
///
/// <param name="helpText">
/// Help text for minishell. This is displayed on 'minishell -?'.
/// </param>
///
/// <param name="preStartWarning">
/// Warning occurred prior to this point, for example, a snap-in fails to load beforehand.
/// This string will be printed out.
/// </param>
///
/// <param name="args">
/// Commandline parameters specified by user.
/// </param>
///
/// <returns>
/// An integer value which should be used as exit code for the
/// process.
/// </returns>
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);
}
}
}