Пример #1
0
 public bool Equals(PSDocumentOption other)
 {
     return(other != null &&
            Document == other.Document &&
            Execution == other.Execution &&
            Markdown == other.Markdown &&
            Output == other.Output);
 }
Пример #2
0
 public PSDocumentOption(PSDocumentOption option)
 {
     // Set from existing option instance
     Document  = new DocumentOption(option?.Document);
     Execution = new ExecutionOption(option?.Execution);
     Markdown  = new MarkdownOption(option?.Markdown);
     Output    = new OutputOption(option?.Output);
 }
Пример #3
0
 public PSDocumentOption(PSDocumentOption option)
 {
     // Set from existing option instance
     Markdown = new MarkdownOption
     {
         WrapSeparator = option.Markdown.WrapSeparator
     };
 }
Пример #4
0
        /// <summary>
        /// Load a YAML formatted PSDocumentOption object from disk.
        /// </summary>
        /// <param name="option"></param>
        /// <param name="path">A file or directory to read options from.</param>
        /// <returns>An options object.</returns>
        /// <remarks>
        /// This method is called from PowerShell.
        /// </remarks>
        public static PSDocumentOption FromFileOrEmpty(PSDocumentOption option, string path)
        {
            if (option == null)
            {
                return(FromFileOrEmpty(path));
            }

            return(!string.IsNullOrEmpty(path) ? Combine(option, FromFileOrEmpty(path)) : option);
        }
Пример #5
0
        private PSDocumentOption(string sourcePath, PSDocumentOption option)
        {
            SourcePath = sourcePath;

            // Set from existing option instance
            Document  = new DocumentOption(option?.Document);
            Execution = new ExecutionOption(option?.Execution);
            Markdown  = new MarkdownOption(option?.Markdown);
            Output    = new OutputOption(option?.Output);
        }
Пример #6
0
        private static PSDocumentOption Combine(PSDocumentOption o1, PSDocumentOption o2)
        {
            var result = new PSDocumentOption(o1?.SourcePath ?? o2?.SourcePath, o1);

            result.Document  = DocumentOption.Combine(result.Document, o2?.Document);
            result.Execution = ExecutionOption.Combine(result.Execution, o2?.Execution);
            result.Markdown  = MarkdownOption.Combine(result.Markdown, o2?.Markdown);
            result.Output    = OutputOption.Combine(result.Output, o2?.Output);
            return(result);
        }
Пример #7
0
        public PSDocumentOption(PSDocumentOption option)
        {
            // Set from existing option instance
            Markdown = new MarkdownOption
            {
                WrapSeparator     = option.Markdown.WrapSeparator,
                Encoding          = option.Markdown.Encoding,
                SkipEmptySections = option.Markdown.SkipEmptySections,
                ColumnPadding     = option.Markdown.ColumnPadding,
                UseEdgePipes      = option.Markdown.UseEdgePipes
            };

            Execution = new ExecutionOption
            {
                LanguageMode = option.Execution.LanguageMode
            };
        }
Пример #8
0
        private static PSDocumentOption FromEnvironment(PSDocumentOption option)
        {
            if (option == null)
            {
                option = new PSDocumentOption();
            }

            // Start loading matching values
            var env = EnvironmentHelper.Default;

            //option.Document.Load(env); // Currently set from cmdlet
            option.Execution.Load(env);
            option.Input.Load(env);
            option.Markdown.Load(env);
            option.Output.Load(env);
            option.Configuration.Load(env);
            return(option);
        }
Пример #9
0
        public static PSDocumentOption FromHashtable(Hashtable hashtable)
        {
            var option = new PSDocumentOption();

            if (hashtable == null)
            {
                return(option);
            }

            // Start loading matching values
            var index = BuildIndex(hashtable);

            //option.Document.Load(index); // Currently set from cmdlet
            option.Execution.Load(index);
            option.Input.Load(index);
            option.Markdown.Load(index);
            option.Output.Load(index);
            option.Configuration.Load(index);
            return(option);
        }