News for hackers. Stuff that matters.
Re:Fx – Terminal JSON Viewer by lucideer on Tuesday September 19, 2023 @10:29AM (#37570483)
jq seems shorter but I don't see how it's more intuitive - ".name" is pretty basic jq syntax but how do I know \() is syntax for wrapping selectors within strings? I've used jq for many years and tbh I've never done string templating with it, so I would need to go digging in the docs.

You can argue that's the case for any language, but it's the fundamental reason DSLs rarely capture the mainstream for on-the-fly utilities. Leveraging existing knowledge of a more heavily used syntax really helps here. Look at awk for example - it's been around forever, and despite its power and ubiquity in OS installs, you'll still see sed in many many more bash scripts because it's leaning on widely used familiar syntax rather than a DSL.

That said - the fx example has "x => Hello, ${x}!" where I would expect "x => `Hello, ${x}!`", so that does indicate to me that fx has its own gotchas lurking - this example could just be contrived to look intuitive.

Re:Fx – Terminal JSON Viewer by iudqnolq on Tuesday September 19, 2023 @02:13PM (#37573903)
Maybe the person you replied to fixed a syntax error in an edit? The backticks are required, and are currently in their comment.
Re:Fx – Terminal JSON Viewer by lucideer on Wednesday September 20, 2023 @11:55AM (#37585782)
After looking more at fx that seems to be the case yes! It's 100% pure js syntax so shouldn't have any gotchas.