From 0febecaa5c156a7176bafed8cb150355a4e350f5 Mon Sep 17 00:00:00 2001 From: James Ruskin Date: Tue, 11 Oct 2022 16:07:20 +0000 Subject: [PATCH] Apply suggestions from code review Adds more translatable strings and removes returns that aren't required. Co-authored-by: Kim J. Nordmo --- .../commands/ChocolateyLicenseCommand.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyLicenseCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyLicenseCommand.cs index 23eb468492..6f68e6ded6 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyLicenseCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyLicenseCommand.cs @@ -29,24 +29,21 @@ namespace chocolatey.infrastructure.app.commands using System.Text; [CommandFor("license", "Retrieve or modify the Chocolatey License")] - class ChocolateyLicenseCommand : ICommand + public class ChocolateyLicenseCommand : ICommand { public void configure_argument_parser(OptionSet optionSet, ChocolateyConfiguration configuration) { // We don't currently expect to have any arguments - return; } public void handle_additional_argument_parsing(IList unparsedArguments, ChocolateyConfiguration configuration) { // We don't currently expect to have any additional arguments - return; } public void handle_validation(ChocolateyConfiguration configuration) { // We don't currently accept any arguments, so there is no validation - return; } public void help_message(ChocolateyConfiguration configuration) @@ -64,7 +61,6 @@ public bool may_require_admin_access() public void noop(ChocolateyConfiguration configuration) { - return; } public void run(ChocolateyConfiguration config) @@ -73,7 +69,14 @@ public void run(ChocolateyConfiguration config) if (config.RegularOutput) { - this.Log().Info("We have found a{0}valid license for Chocolatey {1}, which expires {2}".format_with((ourLicense.IsValid ? " " : "n in"), ourLicense.LicenseType, ourLicense.ExpirationDate)); + if (ourLicense.IsValid) + { + this.Log().Info("We have found a valid license for Chocolatey {0}, which expires {1}", ourLicense.LicenseType, ourLicense.ExpirationDate); + } + else + { + this.Log().Info("We have found an invalid license for Chocolatey {0}, which expires {1}", ourLicense.LicenseType, ourLicense.ExpirationDate); + } this.Log().Info("Registered to: {0}".format_with(ourLicense.Name)); this.Log().Info("Expiration Date: {0} UTC".format_with(ourLicense.ExpirationDate)); this.Log().Info("License type: {0}".format_with(ourLicense.LicenseType));