Add our installer actions

This commit is contained in:
Paul Betts
2014-08-25 11:38:05 -07:00
parent 3965b0703c
commit 082a84ec05

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -7,6 +8,10 @@ using Mono.Options;
namespace Update namespace Update
{ {
enum UpdateAction {
Unset = 0, Install, Uninstall, Download, Update,
}
class Program class Program
{ {
static OptionSet opts; static OptionSet opts;
@@ -19,16 +24,31 @@ namespace Update
return 0; return 0;
} }
bool silentInstall = false;
var updateAction = default(UpdateAction);
string target = default(string);
opts = new OptionSet() { opts = new OptionSet() {
"Usage: Update.exe command [OPTS]", "Usage: Update.exe command [OPTS]",
"Manages Squirrel packages", "Manages Squirrel packages",
"", "",
"Commands",
{ "install=", "Install the app specified by the RELEASES file", v => { updateAction = UpdateAction.Install; target = v; } },
{ "uninstall", "Uninstall the app the same dir as Update.exe", v => updateAction = UpdateAction.Uninstall},
{ "download=", "Download the releases specified by the URL and write new results to stdout as JSON", v => { updateAction = UpdateAction.Download; target = v; } },
{ "update", "Update the application to the latest remote version", v => updateAction = UpdateAction.Update },
"",
"Options:", "Options:",
{ "h|?|help", "Display Help and exit", v => ShowHelp() } { "h|?|help", "Display Help and exit", _ => ShowHelp() },
{ "s|silent", "Silent install", _ => silentInstall = true},
}; };
opts.Parse(args); opts.Parse(args);
if (updateAction == UpdateAction.Unset) {
ShowHelp();
}
return 0; return 0;
} }