File size: 2,971 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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace System.Management.Automation
{
/// <summary>
/// Class ScriptCommandHelpProvider implement the help provider for Functions/ExternalScripts.
/// This class does the same thing as CommandHelpProvider except for decision making: whether
/// a particular command is Function/Script or not.
/// </summary>
/// <remarks>
/// Command Help information are stored in 'help.xml' files. Location of these files
/// can be found from through the engine execution context.
/// </remarks>
internal class ScriptCommandHelpProvider : CommandHelpProvider
{
/// <summary>
/// Constructor for CommandHelpProvider.
/// </summary>
internal ScriptCommandHelpProvider(HelpSystem helpSystem)
: base(helpSystem)
{
}
#region Overrides
/// <summary>
/// Help category for this provider, which is a constant: HelpCategory.Command.
/// </summary>
/// <value>Help category for this provider</value>
internal override HelpCategory HelpCategory
{
get
{
return
HelpCategory.ExternalScript |
HelpCategory.Filter |
HelpCategory.Function |
HelpCategory.Configuration |
HelpCategory.ScriptCommand;
}
}
/// <summary>
/// Gets a command searcher used for ExactMatch help lookup.
/// </summary>
/// <param name="commandName"></param>
/// <param name="context"></param>
/// <returns></returns>
internal override CommandSearcher GetCommandSearcherForExactMatch(string commandName, ExecutionContext context)
{
CommandSearcher searcher = new CommandSearcher(
commandName,
SearchResolutionOptions.None,
CommandTypes.Filter | CommandTypes.Function | CommandTypes.ExternalScript | CommandTypes.Configuration,
context);
return searcher;
}
/// <summary>
/// Gets a command searcher used for searching help.
/// </summary>
/// <param name="pattern"></param>
/// <param name="context"></param>
/// <returns></returns>
internal override CommandSearcher GetCommandSearcherForSearch(string pattern, ExecutionContext context)
{
CommandSearcher searcher =
new CommandSearcher(
pattern,
SearchResolutionOptions.CommandNameIsPattern | SearchResolutionOptions.ResolveFunctionPatterns,
CommandTypes.Filter | CommandTypes.Function | CommandTypes.ExternalScript | CommandTypes.Configuration,
context);
return searcher;
}
#endregion
}
}
|