From 082a84ec05c3d0d0a26b8487c196ecfdf185b746 Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Mon, 25 Aug 2014 11:38:05 -0700 Subject: [PATCH] Add our installer actions --- src/Update/Program.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/Update/Program.cs b/src/Update/Program.cs index c8da2192..673ba9cb 100644 --- a/src/Update/Program.cs +++ b/src/Update/Program.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -7,6 +8,10 @@ using Mono.Options; namespace Update { + enum UpdateAction { + Unset = 0, Install, Uninstall, Download, Update, + } + class Program { static OptionSet opts; @@ -19,16 +24,31 @@ namespace Update return 0; } + bool silentInstall = false; + var updateAction = default(UpdateAction); + string target = default(string); + opts = new OptionSet() { "Usage: Update.exe command [OPTS]", "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:", - { "h|?|help", "Display Help and exit", v => ShowHelp() } + { "h|?|help", "Display Help and exit", _ => ShowHelp() }, + { "s|silent", "Silent install", _ => silentInstall = true}, }; opts.Parse(args); + if (updateAction == UpdateAction.Unset) { + ShowHelp(); + } + return 0; }