forked from appget/appget
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added
appget list
command. Towards appget#22
- Loading branch information
Showing
6 changed files
with
91 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using AppGet.CommandLine; | ||
using AppGet.Infrastructure.Composition; | ||
using AppGet.Update; | ||
using Colorful; | ||
using NLog; | ||
|
||
namespace AppGet.Commands.List | ||
{ | ||
[Handles(typeof(ListOptions))] | ||
public class ListCommandHandler : ICommandHandler | ||
{ | ||
private readonly UpdateService _updateService; | ||
private readonly Logger _logger; | ||
|
||
public ListCommandHandler(UpdateService updateService, Logger logger) | ||
{ | ||
_updateService = updateService; | ||
_logger = logger; | ||
} | ||
|
||
|
||
public async Task Execute(AppGetOption commandOptions) | ||
{ | ||
var matches = await _updateService.GetUpdates(); | ||
|
||
var sorted = matches.OrderByDescending(c => c.Status); | ||
|
||
sorted.ShowTable(); | ||
|
||
Console.WriteLine(); | ||
_logger.Info($"Total Applications: {matches.Count:n0} Updates Available: {matches.Count(c => c.Status == UpdateStatus.Available):n0}"); | ||
Console.WriteLine(); | ||
|
||
if (matches.Any(c => c.Status == UpdateStatus.Available)) | ||
{ | ||
Console.WriteLine("Run 'appget update-all' to apply all updates."); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using CommandLine; | ||
|
||
namespace AppGet.Commands.List | ||
{ | ||
[Verb("list", HelpText = "List all currently installed packages known to AppGet")] | ||
public class ListOptions : AppGetOption | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters