forked from PowerShell/PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSyntaxHelpInfo.cs
More file actions
79 lines (69 loc) · 2.42 KB
/
Copy pathSyntaxHelpInfo.cs
File metadata and controls
79 lines (69 loc) · 2.42 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
/********************************************************************++
Copyright (c) Microsoft Corporation. All rights reserved.
--********************************************************************/
namespace System.Management.Automation
{
/// <summary>
///
/// Class HelpFileHelpInfo keeps track of help information to be returned by
/// command help provider.
///
/// </summary>
internal class SyntaxHelpInfo : BaseCommandHelpInfo
{
/// <summary>
/// Constructor for SyntaxHelpInfo
/// </summary>
private SyntaxHelpInfo(string name, string text, HelpCategory category)
: base(category)
{
_fullHelpObject = PSObject.AsPSObject(text);
_name = name;
_synopsis = text;
}
private string _name = "";
/// <summary>
/// Name for the help info
/// </summary>
/// <value>Name for the help info</value>
override internal string Name
{
get { return _name; }
}
private string _synopsis = "";
/// <summary>
/// Synopsis for the help info
/// </summary>
/// <value>Synopsis for the help info</value>
override internal string Synopsis
{
get { return _synopsis; }
}
private PSObject _fullHelpObject;
/// <summary>
/// Full help object for this help info
/// </summary>
/// <value>Full help object for this help info</value>
override internal PSObject FullHelp
{
get { return _fullHelpObject; }
}
/// <summary>
/// Get help info based on name, text and filename
/// </summary>
/// <param name="name">help topic name</param>
/// <param name="text">help text</param>
/// <param name="category">help category</param>
/// <returns>SyntaxHelpInfo object created based on information provided</returns>
internal static SyntaxHelpInfo GetHelpInfo(string name, string text, HelpCategory category)
{
if (String.IsNullOrEmpty(name))
return null;
SyntaxHelpInfo syntaxHelpInfo = new SyntaxHelpInfo(name, text, category);
if (String.IsNullOrEmpty(syntaxHelpInfo.Name))
return null;
syntaxHelpInfo.AddCommonHelpProperties();
return syntaxHelpInfo;
}
}
}