mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
Rename some methods
This commit is contained in:
@@ -53,8 +53,8 @@ namespace CliFx
|
||||
// Parse command input from arguments
|
||||
var commandInput = _commandInputParser.ParseCommandInput(commandLineArguments);
|
||||
|
||||
// Wait for debugger to be attached if debug mode is requested
|
||||
if (_configuration.IsDebugModeAllowed && commandInput.IsDebugModeRequested())
|
||||
// Wait for debugger to be attached if debug directive was specified
|
||||
if (_configuration.IsDebugModeAllowed && commandInput.IsDebugDirectiveSpecified())
|
||||
{
|
||||
// Whoever comes up with an idea on how to cover this in tests is a genius
|
||||
|
||||
@@ -65,8 +65,8 @@ namespace CliFx
|
||||
await Task.Delay(100);
|
||||
}
|
||||
|
||||
// Show parse results if preview mode is requested
|
||||
if (_configuration.IsPreviewModeAllowed && commandInput.IsPreviewModeRequested())
|
||||
// Show parsed arguments if preview directive was specified
|
||||
if (_configuration.IsPreviewModeAllowed && commandInput.IsPreviewDirectiveSpecified())
|
||||
{
|
||||
_console.Output.WriteLine($"Command name: {commandInput.CommandName}");
|
||||
_console.Output.WriteLine();
|
||||
@@ -131,16 +131,16 @@ namespace CliFx
|
||||
return isError ? -1 : 0;
|
||||
}
|
||||
|
||||
// Show version if it was requested and command wasn't specified
|
||||
if (commandInput.IsVersionRequested() && !commandInput.IsCommandSpecified())
|
||||
// Show version if version option was specified and command was not specified (only works on default command)
|
||||
if (commandInput.IsVersionOptionSpecified() && !commandInput.IsCommandSpecified())
|
||||
{
|
||||
_console.Output.WriteLine(_metadata.VersionText);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Show help if it was requested
|
||||
if (commandInput.IsHelpRequested())
|
||||
// Show help if help option was specified
|
||||
if (commandInput.IsHelpOptionSpecified())
|
||||
{
|
||||
var helpTextSource = new HelpTextSource(_metadata, availableCommandSchemas, targetCommandSchema);
|
||||
_helpTextRenderer.RenderHelpText(_console, helpTextSource);
|
||||
|
||||
@@ -109,27 +109,27 @@ namespace CliFx.Models
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether debug mode was requested in the input.
|
||||
/// Gets whether debug directive was specified in the input.
|
||||
/// </summary>
|
||||
public static bool IsDebugModeRequested(this CommandInput commandInput)
|
||||
public static bool IsDebugDirectiveSpecified(this CommandInput commandInput)
|
||||
{
|
||||
commandInput.GuardNotNull(nameof(commandInput));
|
||||
return commandInput.Directives.Contains("debug", StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether preview mode was requested in the input.
|
||||
/// Gets whether preview directive was specified in the input.
|
||||
/// </summary>
|
||||
public static bool IsPreviewModeRequested(this CommandInput commandInput)
|
||||
public static bool IsPreviewDirectiveSpecified(this CommandInput commandInput)
|
||||
{
|
||||
commandInput.GuardNotNull(nameof(commandInput));
|
||||
return commandInput.Directives.Contains("preview", StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether help was requested in the input.
|
||||
/// Gets whether help option was specified in the input.
|
||||
/// </summary>
|
||||
public static bool IsHelpRequested(this CommandInput commandInput)
|
||||
public static bool IsHelpOptionSpecified(this CommandInput commandInput)
|
||||
{
|
||||
commandInput.GuardNotNull(nameof(commandInput));
|
||||
|
||||
@@ -138,9 +138,9 @@ namespace CliFx.Models
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether version information was requested in the input.
|
||||
/// Gets whether version option was specified in the input.
|
||||
/// </summary>
|
||||
public static bool IsVersionRequested(this CommandInput commandInput)
|
||||
public static bool IsVersionOptionSpecified(this CommandInput commandInput)
|
||||
{
|
||||
commandInput.GuardNotNull(nameof(commandInput));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user