Jump to content

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
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...