Skip to content

Commit

Permalink
(GH-223) Fix handling of LocalOnly for API
Browse files Browse the repository at this point in the history
Move test into the PackageService so it happens during execution regardless of
how it's called.
  • Loading branch information
Jaykul authored and ferventcoder committed Jun 29, 2015
1 parent 5782a21 commit 9df6fd0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@ public void configure_argument_parser(OptionSet optionSet, ChocolateyConfigurati
public void handle_additional_argument_parsing(IList<string> unparsedArguments, ChocolateyConfiguration configuration)
{
configuration.Input = string.Join(" ", unparsedArguments);

if (configuration.ListCommand.LocalOnly)
{
configuration.Sources = ApplicationParameters.PackagesLocation;
configuration.Prerelease = true;
}
}

public void handle_validation(ChocolateyConfiguration configuration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,14 @@ public IEnumerable<PackageResult> list_run(ChocolateyConfiguration config)
{
var packages = new List<IPackage>();

if (config.ListCommand.LocalOnly)
{
config.Sources = ApplicationParameters.PackagesLocation;
config.Prerelease = true;
}
foreach (var package in _nugetService.list_run(config))
{
if (!config.ListCommand.LocalOnly && !config.ListCommand.IncludeRegistryPrograms)
if (!config.ListCommand.LocalOnly || !config.ListCommand.IncludeRegistryPrograms)
{
yield return package;
}
Expand Down Expand Up @@ -489,7 +494,7 @@ public ConcurrentDictionary<string, PackageResult> uninstall_run(ChocolateyConfi
this.Log().Info(@"Uninstalling the following packages:");
this.Log().Info(ChocolateyLoggers.Important, @"{0}".format_with(config.PackageNames));

foreach (var packageConfigFile in config.PackageNames.Split(new[] { ApplicationParameters.PackageNamesSeparator }, StringSplitOptions.RemoveEmptyEntries).or_empty_list_if_null().Where(p => p.EndsWith(".config")).ToList())
if (config.PackageNames.Split(new[] { ApplicationParameters.PackageNamesSeparator }, StringSplitOptions.RemoveEmptyEntries).or_empty_list_if_null().Any(p => p.EndsWith(".config")))
{
throw new ApplicationException("A packages.config file is only used with installs.");
}
Expand Down

0 comments on commit 9df6fd0

Please sign in to comment.