diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs index de65dc3c0b..b9db38712e 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyInfoCommand.cs @@ -16,7 +16,9 @@ namespace chocolatey.infrastructure.app.commands { + using System; using System.Collections.Generic; + using System.Linq; using attributes; using commandline; using configuration; @@ -83,6 +85,24 @@ public override void handle_additional_argument_parsing(IList unparsedAr configuration.ListCommand.Exact = true; } + public override void handle_validation(ChocolateyConfiguration configuration) + { + base.handle_validation(configuration); + + if (string.IsNullOrWhiteSpace(configuration.Input)) + { + throw new ApplicationException(@"A single package id is required to run the info again."); + } + + //Validate only a single package has been passed to info + //TODO: Provide ability to get info on a list of packages + string[] input = configuration.Input.Split(' '); + if (input.Count() > 1) + { + throw new ApplicationException(@"This command only accepts a single package id."); + } + } + public override void help_message(ChocolateyConfiguration configuration) { this.Log().Info(ChocolateyLoggers.Important, "Info Command");