示例#1
0
 public static string Create(CommandMetadata commandMetadata, string helpComment)
 {
     if (commandMetadata == null)
     {
         throw PSTraceSource.NewArgumentNullException("commandMetaData");
     }
     return(commandMetadata.GetProxyCommand(helpComment));
 }
        /// <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));
        }
        /// <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>
        /// <returns>
        /// A string representing Command ScriptBlock.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// commandMetadata is null.
        /// </exception>
        public static string Create(CommandMetadata commandMetadata)
        {
            if (commandMetadata == null)
            {
                throw PSTraceSource.NewArgumentNullException("commandMetaData");
            }

            return(commandMetadata.GetProxyCommand(string.Empty, true));
        }
示例#4
0
 public static string Create(CommandMetadata commandMetadata, string helpComment) => commandMetadata != null?commandMetadata.GetProxyCommand(helpComment) : throw ProxyCommand.tracer.NewArgumentNullException("commandMetaData");