Refactor CLI (#81)

This commit is contained in:
Alexey Golub
2018-08-13 22:49:13 +03:00
committed by GitHub
parent 0faa427970
commit bd9dc6455f
23 changed files with 338 additions and 227 deletions

View File

@@ -0,0 +1,38 @@
using System;
using System.Threading.Tasks;
using DiscordChatExporter.Cli.Verbs.Options;
using DiscordChatExporter.Core.Services;
namespace DiscordChatExporter.Cli.Verbs
{
public class UpdateAppVerb : Verb<UpdateAppOptions>
{
public UpdateAppVerb(UpdateAppOptions options)
: base(options)
{
}
public override async Task ExecuteAsync()
{
// Get update service
var container = new Container();
var updateService = container.Resolve<IUpdateService>();
// TODO: this is configured only for GUI
// Get update version
var updateVersion = await updateService.CheckPrepareUpdateAsync();
if (updateVersion != null)
{
Console.WriteLine($"Updating to version {updateVersion}");
updateService.NeedRestart = false;
updateService.FinalizeUpdate();
}
else
{
Console.WriteLine("There are no application updates available.");
}
}
}
}