File size: 2,100 Bytes
8c763fb | 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 | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace System.Management.Automation
{
/// <summary>
/// Class HelpFileHelpInfo keeps track of help information to be returned by
/// command help provider.
/// </summary>
internal sealed class SyntaxHelpInfo : BaseCommandHelpInfo
{
/// <summary>
/// Constructor for SyntaxHelpInfo.
/// </summary>
private SyntaxHelpInfo(string name, string text, HelpCategory category)
: base(category)
{
FullHelp = PSObject.AsPSObject(text);
Name = name;
Synopsis = text;
}
/// <summary>
/// Name for the help info.
/// </summary>
/// <value>Name for the help info</value>
internal override string Name { get; } = string.Empty;
/// <summary>
/// Synopsis for the help info.
/// </summary>
/// <value>Synopsis for the help info</value>
internal override string Synopsis { get; } = string.Empty;
/// <summary>
/// Full help object for this help info.
/// </summary>
/// <value>Full help object for this help info</value>
internal override PSObject FullHelp { get; }
/// <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;
}
}
}
|