Query jvm options with Alfred workflow
I found a full list of JVM options here with explanations and default values given. Thanks to the author. It’s a great reference. Based on the list, I create a simple Alfred workflow to query options offline. My idea is straightforward. Once I type jvm and the option, the workflow can list all the related options containing the keyword. It works as shown in below gif.
It’s my first time to write an Alfred workflow. I guess it won’t be hard. I only need to run a python script which can return all the items containing the query keyword. The key points are how to retrieve the query from Alfred and feed the result back to Alfred. After some research, I found that script filter is totally what I want. It can pass input as argv and accept json as output. Key takeaways are listed below.
- use
$1
to pass input to the script, usesys.argv[1]
to access it in python. - What writes to the console by your script will be parsed by Alfred for display. But it should follow the json format specified by Alfred.
- You can debug the script by click the spider icon at the top right corner.
- You can navigate to the workflow folder by clicking the
four square
icon. All the local resources, such as images and data files, should be placed in that folder. Then when exporting the workflow, nothing will be lost. - How about the string is too long and cannot be fully displayed in the dropdown list row? Leverage the
largetype
property of the json. After set largetype, you can presscommand + L
to view the whole text in large font style.
The python script is attached below.