From c02047ef2a5986791f7130a8ceb6a4c4f83a8f4b Mon Sep 17 00:00:00 2001 From: Nikita Voloboev Date: Mon, 14 Aug 2017 00:49:20 +0200 Subject: [PATCH] need to add auto updating --- main.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 156eed4..6f75eed 100644 --- a/main.go +++ b/main.go @@ -14,7 +14,7 @@ import ( // name of background job that checks for updates const updateJobName = "checkForUpdate" -const repo = "deanishe/alfred-ssh" +const repo = "nikitavoloboev/web-searches" var ( // kingpin and script @@ -38,6 +38,10 @@ var ( wf *aw.Workflow ) +type options struct { + checkForUpdate bool // download list of available releases +} + // sets up kingpin flags func init() { wf = aw.NewWorkflow(nil) @@ -82,6 +86,21 @@ func filterWebsites(links map[string]string) { wf.SendFeedback() } +// TODO: does not work I think +func runUpdate(o *options) { + wf.TextErrors = true + + if err := wf.CheckForUpdate(); err != nil { + wf.FatalError(err) + } + + if wf.UpdateAvailable() { + log.Printf("[update] An update is available") + } else { + log.Printf("[update] Workflow is up to date") + } +} + func run() { var err error