5 ms·
This is cool... but it appears to also work as an HTTP client as well? I'm not sure why the additional complexity of including this is needed. I maintain tha
by kbenson 9y ago
This is cool... but it appears to also work as an HTTP client as well? I'm not sure why the additional complexity of including this is needed.
I maintain that any HTTP client functionality that supports enough options to be useful is complex and if it supports so few options that it's a toy, why include it?
There is non-negligible overhead in keeping track of what shell tools can make network requests, and not being correct and up to date in that area has been the cause of numerous bugs and security issues in tool sets and programs that include and utilize a component like this without realizing it.
To many, this might sound like some overly nit-picky complaint, but I maintain if you ask just about anyone that's been in the trenches as a sysadmin for more than a couple years whether they think saving the few characters it takes to use curl and pipe is a good trade-off for the possible unintended consequences of some developer shelling out to this without proper validation from some webapp, they'll tell you no.
This tool seems awesome, but keep it simple. It's not like it's a GUI tool and it's hard to pass data between programs. A pipe is perfect here.
- vbsteven 9y agoI came here to say the same thing. It looks like a great tool which I will use frequently on large json files but I don't get why the author bothered to implement a basic HTTP client with some curl-like options when it can just as well read from stdin.
- erric 9y agoMaybe in a container build environment like CircleCI where having a small concise toolset is desirable?
- cup-of-tea 9y agoThe author just hasn't fully grokked the command line yet.
- kbenson 9y agoThat seems overly harsh. It's a cool utility, and the author even shows it being used with pipes in numerous ways. I'm just arguing that including non-essential features is a trade-off. Often it's just complexity for ease of use, but I think this one has some possible security implications, and what you get for that may not be worthwhile.
- cup-of-tea 9y agoHarsh because I said what you said in about 1/20th of the space? In this case curl is the tool for the job and, for many reasons, it's best to keep such tools to a bare minimum, as you correctly point out. I would file a bug report to remove the HTTP parts and update the documentation to show using curl.
- nothrabannosir 9y agoHarsh because it became negative about the person, rather than the tool. Being immediately negative and critical of the tool is already quite harsh in the real world, but engineers (and especially HN) have a tendency to do this and find it normal. I don't know why, but that horse seems out of the barn. But a glib dismissal of an emotional being's knowledge after they make themselves vulnerable is just that: harsh. I appreciate your relentless cutting through the bullshit and fluff attitude. I get it, and I do see the value: say it like it is, don't sugar coat it. But in this case, you cut right down to and through a person's flesh. It's different when you talk about established culture or faceless companies, from when you talk about a human being who is literally reading this right now. Edit: just to add, it seems to me, your attitude is precisely what would make you a good engineer. Bam, here's the problem, fix this, the system is better. It wasn't intended as personal, I don't think. But yeah, at the end of the day, we're all vulnerable emotional beings who crave love and affection. We can be honest and clear, and still a little supportive and loving at the same time :)
- cup-of-tea 9y ago> But in this case, you cut right down to and through a person's flesh. Please... Do you really think that upon reading my comment the author going to assume the foetal position and cry? Are you projecting your insecurities on the author? (ie. "I couldn't take this abuse so therefore neither could he.") Or are you assuming the author is much more sensitive than you? (ie. "I can and do take such criticism from people every day but, despite this, I'm sure the author cannot handle it.") Children in my school used to use the phrase "that's harsh!" upon certain remarks from other children. And do you know which part cut the deepest? It was the "that's harsh". Why? Because it is a double attack on me. It both acknowledges that was said is true and adds that I am too weak to handle the attack myself. You might think you are helping, but you are actually adding a second blow. If someone tells me I haven't grokked something then I thank them because I now know what to learn next.
- TomNomNom 9y agoAuthor of the tool here. I can definitely see why you might think that, but I don't think it's fair to bring my presumed lack of understanding of the command line up as a reason; especially when some of the documentation[0] is a bit of a pipe party. I've addressed this a little in another comment already[1], but the truth is that the HTTP client functionality only really exists for the sake of a few users that I heard from directly. curl being a default on Windows now[2] may be enough that this feature can be removed. Perhaps the feature should never have existed, but now that it does it's difficult to justify removing it - you never know whose workflow you might break[3]. [0] - https://github.com/tomnomnom/gron/blob/master/ADVANCED.mkd https://github.com/tomnomnom/gron/blob/master/ADVANCED.mkd [1] - https://news.ycombinator.com/item?id=16733361 https://news.ycombinator.com/item?id=16733361 [2] - https://blogs.technet.microsoft.com/virtualization/2017/12/19/tar-and-curl-come-to-windows/ https://blogs.technet.microsoft.com/virtualization/2017/12/1... [3] - https://xkcd.com/1172/ https://xkcd.com/1172/
- cup-of-tea 9y agoFair enough. Might be worth changing the docs to use curl and adding that the built in simple HTTP client is a convenience that exists for limited platforms.
- TomNomNom 9y agoAuthor of the tool here. I think you raise a good point; and I don't think it overly nit-picky. Personally I don't find myself using the built-in HTTP client at all (and pipe the output of curl instead); but I know people who do. I ummed and ahhed about keeping this functionality for a while, and surveyed the—at the time fairly small—user base to figure out what I should do. What I found was a subset of users whose use-case was very different to my own; they were often running Windows, with no install of curl (which I believe is actually a default on Windows now?), and only wanted very basic functionality. I'm definitely a proponent of the Unix philosophy, but I try my best to be pragmatic, especially where it can lower the barrier to entry for users.
- kbenson 9y agoI had thought of this after my original comment. Windows provides a slightly different set of assumptions that a traditional UNIX-like platform. Mainly, that piping is not as common and the chances that the operating system the tool is deployed on will be used as a server at much reduced. There are a couple middle-ground solutions which might be worth exploring: - Only build that functionality on windows. Optionally, provide two packages for windows, one with URL fetching and one without it. - Provide a flag that enables/disables the feature. Either default toit off and allow it to be enabled with a flag (and a helpful error message if oyu attempt to use it without a flag) or vice-versa. - Do nothing. In the end, it's an entirely valid decision to leave it as it is unchanged. I thought it was something worth discussing, both for this tool and for the larger trend in general, but that doesn't mean the problem is so large that it makes the tool unusable until addressed. In any case, thanks for making this. The simplicity and obvious usefulness of this tool means that as someone who deals with JSON quite often, generally in an archived form where I care about one or two entries in lists of hundreds, I imagine I'll be finding lots of use for it in the future.
- erric 9y ago>with no install of curl (which I believe is actually a default on Windows now?) Alas, no. It's just an alias to invoke-webrequest, or what ever their equivalent power shell incantation is.
- fragmede 9y agoIs it? The one the curl does very well is make network requests. Wait no, that's netcat*.