Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
`"valid": false` is a bad choice for the default for wf.NewItem #4
I understand that the go struct is likely just defaulting the boolean value to false, but for the reasons I outlined, I recommend that the correct default behavior of this property is use the
This is the main reason. It's first and foremost a Go library, where booleans are generally expected to be
I did consider defaulting to
But currently, I am unconvinced that they are intuitive enough to justify the "magic".
The library has never tried to follow Alfred's default behaviour. It imposes its own logic because Alfred's default behaviour never made a whole lot of sense (turns out a long-standing bug was at fault for much of it).
In what way? This also seems to stem from your incorrect assumption that items are valid by default.
That's a non-starter. If you set
In any case, there's no reason to not emit a value for
Maybe I have asked this wrong. It’s less that the default should be true than that the ability to omit it all together is more consistent with how Alfred works in other contexts. By more intuitive, I mean that if you have made Alfred workflows before without the library, not specififying a parameter in the Items structure (ie: calling
Not so if you make the
My main argument for this change is to consider the user experience for a new user to this library. A new user experiments with a call to
If you are still unconvinced that making it
BTW - quick side note: Thank you so much for making this library! I wasn't certain I needed a library vs hand-coding the JSON responses was the way to go, but the way you wrap panics, and handle environment variables and caching saved me a ton of development time. Thanks!
What's the point? Omitting
Okay. You're the first new user to mention having this issue.
Perhaps any other reading users can chime in if they were caught out by the behaviour, too?
There's nothing "magic" about the property, and if you understand Alfred's JSON format already, you can see exactly what's going on by looking at the generated JSON in Alfred's debugger (which is why the library pretty-prints the JSON).
I think that would be potentially misleading, seeing as that example wants an invalid item. Explicitly setting
It is correctly and explicitly used in all the real examples, which are mentioned immediately after the example code in the README.
Yeah, you don't really need a library for Alfred 3. The library is Alfred 2 vintage, and its old XML format was much trickier to generate.
So, its main utility is to eliminate boilerplate and provide some APIs that make it easy to very quickly plug some data source or useful library into Alfred.