From 0662f341e6cfeb40d816db8c67c61c24d3875525 Mon Sep 17 00:00:00 2001 From: Alexey Golub Date: Sat, 24 Aug 2019 18:25:56 +0300 Subject: [PATCH] Rename some methods --- CliFx/CliApplication.cs | 16 ++++++++-------- CliFx/Models/Extensions.cs | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/CliFx/CliApplication.cs b/CliFx/CliApplication.cs index 4eb947e..b585bca 100644 --- a/CliFx/CliApplication.cs +++ b/CliFx/CliApplication.cs @@ -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); diff --git a/CliFx/Models/Extensions.cs b/CliFx/Models/Extensions.cs index b5d6810..2dc5e35 100644 --- a/CliFx/Models/Extensions.cs +++ b/CliFx/Models/Extensions.cs @@ -109,27 +109,27 @@ namespace CliFx.Models } /// - /// Gets whether debug mode was requested in the input. + /// Gets whether debug directive was specified in the input. /// - 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); } /// - /// Gets whether preview mode was requested in the input. + /// Gets whether preview directive was specified in the input. /// - 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); } /// - /// Gets whether help was requested in the input. + /// Gets whether help option was specified in the input. /// - 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 } /// - /// Gets whether version information was requested in the input. + /// Gets whether version option was specified in the input. /// - public static bool IsVersionRequested(this CommandInput commandInput) + public static bool IsVersionOptionSpecified(this CommandInput commandInput) { commandInput.GuardNotNull(nameof(commandInput));