示例#1
0
        /// <summary>
        /// This method constructs a string representing the command specified by <paramref name="commandMetadata"/>.
        /// The returned string is a ScriptBlock which can be used to configure a Cmdlet/Function in a Runspace.
        /// </summary>
        /// <param name="commandMetadata">
        /// An instance of CommandMetadata representing a command.
        /// </param>
        /// <param name="helpComment">
        /// The string to be used as the help comment.
        /// </param>
        /// <param name="generateDynamicParameters">
        /// A boolean that determines whether the generated proxy command should include the functionality required
        /// to proxy dynamic parameters of the underlying command.
        /// </param>
        /// <returns>
        /// A string representing Command ScriptBlock.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// commandMetadata is null.
        /// </exception>
        public static string Create(CommandMetadata commandMetadata, string helpComment, bool generateDynamicParameters)
        {
            if (commandMetadata == null)
            {
                throw PSTraceSource.NewArgumentNullException("commandMetaData");
            }

            return(commandMetadata.GetProxyCommand(helpComment, generateDynamicParameters));
        }
示例#2
0
        /// <summary>
        /// This method constructs a string representing the command specified by <paramref name="commandMetadata"/>.
        /// The returned string is a ScriptBlock which can be used to configure a Cmdlet/Function in a Runspace.
        /// </summary>
        /// <param name="commandMetadata">
        /// An instance of CommandMetadata representing a command.
        /// </param>
        /// <param name="helpComment">
        /// The string to be used as the help comment.
        /// </param>
        /// <returns>
        /// A string representing Command ScriptBlock.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// commandMetadata is null.
        /// </exception>
        public static string Create(CommandMetadata commandMetadata, string helpComment)
        {
            if (commandMetadata == null)
            {
                throw PSTraceSource.NewArgumentNullException("commandMetaData");
            }

            return(commandMetadata.GetProxyCommand(helpComment, true));
        }