Jump to content
Terminal

AwGo Update Function Help

Recommended Posts

Just a heads-up: in future could you post any question in the AwGo thread, rather than making a new one?

 

It looks like there are a few things not quite right.

 

The way the updater works is that wf.CheckForUpdate() retrieves and caches a list of available releases, and wf.UpdateAvailable() compares the cached list against the current version. As far as I can tell, you don't actually run your update command anywhere except from your ;manupdate Script Filter (which looks like it's for testing?), so there's no cached list of releases for wf.UpdateAvailable() to check.

 

You either need to run your update command in the background from your main Script Filter command or from the Run Script actions it's connected to, so there's a cached list of releases.

 

This show update status if query is empty clause won't work because you have the Script Filter set to "Argument Required", meaning Alfred doesn't actually run your program if the query is empty.

 

You also can't use the workflow:update trick to install an update (or any other "magic actions") because you aren't calling wf.Args() (as far as I can see). You don't have to integrate it with cobra or anything, you just need to call it somewhere. See the MagicAction docs.

 

Finally, you should consider wrapping your entry point in wf.Run() (or at least the Script Filters). It'll catch any panics, log them and show the user an error message instead of silently failing (Alfred's default error-handling behaviour). It also means you can just panic(err) expected errors, like you might in an HTTP handler, instead of bubbling them all the way up through your program.

Edited by deanishe

Share this post


Link to post

Thank! And yes, didn’t realize there was a thread. 
 

that all makes sense, I wasn’t sure how magic functions worked. So I will read that post. 

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...