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