Terminal Posted January 11, 2020 Share Posted January 11, 2020 @deanishe Just wondering if you could look at this repo and let me know why the update function isn't working? The code is a mess at the moment, but you should be able to make sense of it https://github.com/TheSecEng/Alfred-Man/tree/master Link to comment
deanishe Posted January 12, 2020 Share Posted January 12, 2020 (edited) 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 January 12, 2020 by deanishe Link to comment
Terminal Posted January 12, 2020 Author Share Posted January 12, 2020 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. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now