From edf22cf7c98107bab13bdd32adc9ea90cc8b4f52 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Wed, 4 Feb 2015 04:29:05 -0600 Subject: [PATCH] (GH-60) warn when setting pin to list --- .../commands/ChocolateyPinCommand.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs index 44474f17c6..a736a747ee 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyPinCommand.cs @@ -64,10 +64,15 @@ public void handle_additional_argument_parsing(IList unparsedArguments, } var command = PinCommandType.unknown; - Enum.TryParse(unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault(), true, out command); - - if (command == PinCommandType.unknown) command = PinCommandType.list; + string unparsedCommand = unparsedArguments.DefaultIfEmpty(string.Empty).FirstOrDefault(); + Enum.TryParse(unparsedCommand, true, out command); + if (command == PinCommandType.unknown) + { + this.Log().Warn("Unkown command {0}. Setting to list.".format_with(unparsedCommand)); + command = PinCommandType.list; + } + configuration.PinCommand.Command = command; configuration.Sources = ApplicationParameters.PackagesLocation; configuration.ListCommand.LocalOnly = true;