mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
Cleanup
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
public string ExecutableName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Application version text.
|
||||
/// Application version.
|
||||
/// </summary>
|
||||
public string Version { get; }
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace CliFx
|
||||
// Handle preview directive
|
||||
if (IsPreviewModeEnabled(commandInput))
|
||||
{
|
||||
_console.WriteCommandInput(commandInput);
|
||||
_console.Output.WriteCommandInput(commandInput);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace CliFx
|
||||
// Handle help option
|
||||
if (ShouldShowHelpText(commandSchema, commandInput))
|
||||
{
|
||||
_console.WriteHelpText(helpContext);
|
||||
_console.Output.WriteHelpText(helpContext);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -150,12 +150,12 @@ namespace CliFx
|
||||
}
|
||||
catch (CliFxException ex)
|
||||
{
|
||||
_console.WriteException(ex);
|
||||
_console.Error.WriteException(ex);
|
||||
|
||||
if (ex.ShowHelp)
|
||||
{
|
||||
_console.Output.WriteLine();
|
||||
_console.WriteHelpText(helpContext);
|
||||
_console.Output.WriteHelpText(helpContext);
|
||||
}
|
||||
|
||||
return ex.ExitCode;
|
||||
@@ -200,7 +200,7 @@ namespace CliFx
|
||||
// developer, so we don't swallow them in that case.
|
||||
catch (Exception ex) when (!Debugger.IsAttached)
|
||||
{
|
||||
_console.WriteException(ex);
|
||||
_console.Error.WriteException(ex);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace CliFx
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a command the application.
|
||||
/// Adds a command to the application.
|
||||
/// </summary>
|
||||
public CliApplicationBuilder AddCommand<TCommand>() where TCommand : ICommand =>
|
||||
AddCommand(typeof(TCommand));
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace CliFx.Formatting
|
||||
|
||||
internal static class CommandInputConsoleFormatterExtensions
|
||||
{
|
||||
public static void WriteCommandInput(this IConsole console, CommandInput commandInput) =>
|
||||
new CommandInputConsoleFormatter(console.Output).WriteCommandInput(commandInput);
|
||||
public static void WriteCommandInput(this ConsoleWriter consoleWriter, CommandInput commandInput) =>
|
||||
new CommandInputConsoleFormatter(consoleWriter).WriteCommandInput(commandInput);
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,7 @@ namespace CliFx.Formatting
|
||||
|
||||
internal static class ExceptionConsoleFormatterExtensions
|
||||
{
|
||||
public static void WriteException(this IConsole console, Exception exception) =>
|
||||
new ExceptionConsoleFormatter(console.Error).WriteException(exception);
|
||||
public static void WriteException(this ConsoleWriter consoleWriter, Exception exception) =>
|
||||
new ExceptionConsoleFormatter(consoleWriter).WriteException(exception);
|
||||
}
|
||||
}
|
||||
@@ -443,7 +443,7 @@ namespace CliFx.Formatting
|
||||
|
||||
internal static class HelpConsoleFormatterExtensions
|
||||
{
|
||||
public static void WriteHelpText(this IConsole console, HelpContext context) =>
|
||||
new HelpConsoleFormatter(console.Output, context).WriteHelpText();
|
||||
public static void WriteHelpText(this ConsoleWriter consoleWriter, HelpContext context) =>
|
||||
new HelpConsoleFormatter(consoleWriter, context).WriteHelpText();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user