MegaBites-AI/Windows-powershell
0372
1// Copyright (c) Microsoft Corporation.2// Licensed under the MIT License.3 4namespace System.Management.Automation5{6 /// <summary>7 /// Class ScriptCommandHelpProvider implement the help provider for Functions/ExternalScripts.8 /// This class does the same thing as CommandHelpProvider except for decision making: whether9 /// a particular command is Function/Script or not.10 /// </summary>11 /// <remarks>12 /// Command Help information are stored in 'help.xml' files. Location of these files13 /// can be found from through the engine execution context.14 /// </remarks>15 internal class ScriptCommandHelpProvider : CommandHelpProvider16 {17 /// <summary>18 /// Constructor for CommandHelpProvider.19 /// </summary>20 internal ScriptCommandHelpProvider(HelpSystem helpSystem)21 : base(helpSystem)22 {23 }24 25 #region Overrides26 27 /// <summary>28 /// Help category for this provider, which is a constant: HelpCategory.Command.29 /// </summary>30 /// <value>Help category for this provider</value>31 internal override HelpCategory HelpCategory32 {33 get34 {35 return36 HelpCategory.ExternalScript |37 HelpCategory.Filter |38 HelpCategory.Function |39 HelpCategory.Configuration |40 HelpCategory.ScriptCommand;41 }42 }43 44 /// <summary>45 /// Gets a command searcher used for ExactMatch help lookup.46 /// </summary>47 /// <param name="commandName"></param>48 /// <param name="context"></param>49 /// <returns></returns>50 internal override CommandSearcher GetCommandSearcherForExactMatch(string commandName, ExecutionContext context)51 {52 CommandSearcher searcher = new CommandSearcher(53 commandName,54 SearchResolutionOptions.None,55 CommandTypes.Filter | CommandTypes.Function | CommandTypes.ExternalScript | CommandTypes.Configuration,56 context);57 58 return searcher;59 }60 61 /// <summary>62 /// Gets a command searcher used for searching help.63 /// </summary>64 /// <param name="pattern"></param>65 /// <param name="context"></param>66 /// <returns></returns>67 internal override CommandSearcher GetCommandSearcherForSearch(string pattern, ExecutionContext context)68 {69 CommandSearcher searcher =70 new CommandSearcher(71 pattern,72 SearchResolutionOptions.CommandNameIsPattern | SearchResolutionOptions.ResolveFunctionPatterns,73 CommandTypes.Filter | CommandTypes.Function | CommandTypes.ExternalScript | CommandTypes.Configuration,74 context);75 76 return searcher;77 }78 79 #endregion80 }81}82 