Remove autoupdate feature from CLI entirely

pull/116/head
Oleksii Holub 6 years ago
parent d28e81f8dc
commit 4144911208

@ -43,8 +43,7 @@ namespace DiscordChatExporter.Cli
typeof(ExportChatOptions), typeof(ExportChatOptions),
typeof(GetChannelsOptions), typeof(GetChannelsOptions),
typeof(GetDirectMessageChannelsOptions), typeof(GetDirectMessageChannelsOptions),
typeof(GetGuildsOptions), typeof(GetGuildsOptions)
//typeof(UpdateAppOptions)
}; };
// Parse command line arguments // Parse command line arguments
@ -55,7 +54,6 @@ namespace DiscordChatExporter.Cli
parsedArgs.WithParsed<GetChannelsOptions>(o => new GetChannelsVerb(o).Execute()); parsedArgs.WithParsed<GetChannelsOptions>(o => new GetChannelsVerb(o).Execute());
parsedArgs.WithParsed<GetDirectMessageChannelsOptions>(o => new GetDirectMessageChannelsVerb(o).Execute()); parsedArgs.WithParsed<GetDirectMessageChannelsOptions>(o => new GetDirectMessageChannelsVerb(o).Execute());
parsedArgs.WithParsed<GetGuildsOptions>(o => new GetGuildsVerb(o).Execute()); parsedArgs.WithParsed<GetGuildsOptions>(o => new GetGuildsVerb(o).Execute());
parsedArgs.WithParsed<UpdateAppOptions>(o => new UpdateAppVerb(o).Execute());
// Show token help if help requested or no verb specified // Show token help if help requested or no verb specified
parsedArgs.WithNotParsed(errs => parsedArgs.WithNotParsed(errs =>

@ -1,9 +0,0 @@
using CommandLine;
namespace DiscordChatExporter.Cli.Verbs.Options
{
[Verb("update", HelpText = "Updates this application to the latest version.")]
public class UpdateAppOptions
{
}
}

@ -1,38 +0,0 @@
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.");
}
}
}
}
Loading…
Cancel
Save