private int?HandlePreviewDirective(CommandInput commandInput) { // Preview mode is enabled if it's allowed in the application and it was requested via corresponding directive var isPreviewMode = _configuration.IsPreviewModeAllowed && commandInput.IsPreviewDirectiveSpecified(); // If not in preview mode, pass execution to the next handler if (!isPreviewMode) { return(null); } // Render command name _console.Output.WriteLine($"Command name: {commandInput.CommandName}"); _console.Output.WriteLine(); // Render directives _console.Output.WriteLine("Directives:"); foreach (var directive in commandInput.Directives) { _console.Output.Write(" "); _console.Output.WriteLine(directive); } // Margin _console.Output.WriteLine(); // Render options _console.Output.WriteLine("Options:"); foreach (var option in commandInput.Options) { _console.Output.Write(" "); _console.Output.WriteLine(option); } // Short-circuit with exit code 0 return(0); }