Post 9mDas2WLuSnLFclldA by paperdigits@mastodon.social
(DIR) More posts by paperdigits@mastodon.social
(DIR) Post #9mCgPwnpyrc5yXyYts by fribbledom@mastodon.social
2019-08-24T07:05:09Z
1 likes, 2 repeats
It's 2019 and our coreutils still don't have a way to output structured, parseable data.I'm so fed up with "stringly-typed" shell programming π
(DIR) Post #9mCgW5dk2MvB7ZBNYm by bb010g@weirder.earth
2019-08-24T07:05:48Z
0 likes, 0 repeats
@fribbledom big mood
(DIR) Post #9mCgfOlUIgxd2gFDF2 by alice@bidule.menf.in
2019-08-24T07:07:57.863950Z
0 likes, 0 repeats
@fribbledom Functional strongly typed shell now ! ββ
(DIR) Post #9mCgs3aeL5iz8OD8pk by tyil@soc.fglt.nl
2019-08-24T07:10:12.921613Z
0 likes, 0 repeats
@fribbledom I prefer having human-readable output as the default, as the machine is working for a human. However, having ways to convert output from tools to JSON/YAML would be convenient, I think.
(DIR) Post #9mCgsiYy0FjwD2jsP2 by chaomodus@radical.town
2019-08-24T07:10:17Z
0 likes, 0 repeats
@fribbledom should be a --json options so you can use jq
(DIR) Post #9mCh7gCj3TLnEnTDZg by Wolf480pl@niu.moe
2019-08-24T07:13:03Z
0 likes, 0 repeats
@fribbledom really? From my experience, most of them output something very close to CSV/DSV, which you can easily parse with awk.
(DIR) Post #9mChJUETOLgpaBuwvQ by epicmorphism@satania.space
2019-08-24T07:15:13.385439Z
0 likes, 0 repeats
@fribbledom itβs the UNIX way (tm)
(DIR) Post #9mChh6dwkNwvN95xsu by fribbledom@mastodon.social
2019-08-24T07:19:27Z
0 likes, 0 repeats
@Wolf480plOk, I rephrase:"...a way to output _sanely_ structured, parseable data..."π
(DIR) Post #9mChveZXOgNKefyBF2 by loke@functional.cafe
2019-08-24T07:22:00Z
0 likes, 0 repeats
@fribbledomThe answer is, as usual Lisp. π@Wolf480pl
(DIR) Post #9mChwRICFwcRl5EWW0 by Wolf480pl@niu.moe
2019-08-24T07:22:11Z
0 likes, 0 repeats
@fribbledom >suggesting awk is insane>suggesting JavaScript Object Notation is sanerYou've lost the Path of Unix. But it's not too late. Repent!
(DIR) Post #9mCi3TYaEgn4oAFlaa by Wolf480pl@niu.moe
2019-08-24T07:23:28Z
0 likes, 0 repeats
@fribbledom Ok, but seriously:What is your problem?What's wrong with having tabular data as a bunch of space- or tab-separated columns?Also, which particular tool's output are you trying to parse?
(DIR) Post #9mCi55YiQkJYxX5Hg8 by fribbledom@mastodon.social
2019-08-24T07:23:47Z
0 likes, 0 repeats
@Wolf480plI haven't suggested JSON just yet, but yes I'd much rather work with JSON than CSV. Who wouldn't?
(DIR) Post #9mCi8I7ICJcYm6mh3w by Wolf480pl@niu.moe
2019-08-24T07:24:21Z
0 likes, 0 repeats
@fribbledom I wouldn't.1:1
(DIR) Post #9mCiBiOIxzCD8GNH0q by tn5421@niu.moe
2019-08-24T07:25:00Z
0 likes, 0 repeats
@fribbledom @Wolf480pl i feel like json is easier than csvbut aren't there formats even easier than json?
(DIR) Post #9mCiLzCzIJdaBcyjJI by wohali@octodon.social
2019-08-24T07:26:46Z
0 likes, 0 repeats
@fribbledom @Wolf480pl no question, jq should be in coreutils. except of course it's MIT licensed ;)
(DIR) Post #9mCiQQp6Z6WmzTvYP2 by Wolf480pl@niu.moe
2019-08-24T07:27:39Z
0 likes, 0 repeats
@bort @fribbledom ok, but what about DSV?
(DIR) Post #9mCiQdZHBGagW9cb2G by fribbledom@mastodon.social
2019-08-24T07:27:41Z
0 likes, 0 repeats
@Wolf480plOk, let's turn this into a fun poll π
(DIR) Post #9mCiT792Bb6UpMWoVs by Wolf480pl@niu.moe
2019-08-24T07:28:08Z
0 likes, 0 repeats
@fribbledom or, you could tell me what data you're trying to parse and what problem you're having
(DIR) Post #9mCiaKsXWQ6TRwFy08 by pfm@edolas.world
2019-08-24T07:29:26.741426Z
0 likes, 0 repeats
@lokeI wish LispMs were still around, available for me to use...@fribbledom @Wolf480pl
(DIR) Post #9mCibqlMSkDMctcYrY by Jmtd@mastodon.cloud
2019-08-24T07:29:40Z
0 likes, 0 repeats
@fribbledom is it even on the roadmap? I thought it was NACK rather than backlog. If you're waiting for it you'll be waiting forever.
(DIR) Post #9mCicXWdTMz9Fg3uNc by rain@niu.moe
2019-08-24T07:29:50Z
0 likes, 1 repeats
@Wolf480pl @bort @fribbledom iproute2 can output jsonit would be OK if tools outputted a specific formally specified CSV but they all just printf whatever they want - so you have to create a new ad-hoc parser for every program whose data you want
(DIR) Post #9mCitrfdpILCecXGWe by fribbledom@mastodon.social
2019-08-24T07:32:58Z
0 likes, 0 repeats
@Wolf480plI really don't have a specific problem in mind. I'm just generally fed up with "magic" string handling code that breaks every other month.
(DIR) Post #9mCj6LCfql4Diuw3pg by Wolf480pl@niu.moe
2019-08-24T07:35:13Z
0 likes, 0 repeats
@bort @fribbledom if your data isn't nested, I don't see any advantage to JSON.AFAIK JSON and CSV have very similar quoting/escaping rules. And DSV is even simpler than CSV, because there's no quoting, you just pick a separator that doesn't appear in the data. Most of the time, tab is good enough.
(DIR) Post #9mCjqEQtM5tC2sT5Tk by Wolf480pl@niu.moe
2019-08-24T07:43:31Z
0 likes, 0 repeats
@bort @fribbledom Still souds like more of a problem with buggy parsers than the format itself. Have you tried using awk?
(DIR) Post #9mCk0ORiyqtFztheF6 by Wolf480pl@niu.moe
2019-08-24T07:45:21Z
0 likes, 0 repeats
@bort @fribbledom or, if you're writing code, sth likestr.split('\t') ?
(DIR) Post #9mCnzW1xhCLZ2zUQJU by roserin@weirder.earth
2019-08-24T08:30:00Z
0 likes, 0 repeats
@fribbledom I like shell string-style programming! :blobcatpeek:
(DIR) Post #9mCo5F0psjNg0Ih2LQ by fribbledom@mastodon.social
2019-08-24T08:31:02Z
0 likes, 0 repeats
@roserin Clearly you need a new hobby! Have you tried collecting stamps? π
(DIR) Post #9mCogrMmFIZ7fetUJ6 by froosh@aus.social
2019-08-24T08:37:54Z
0 likes, 0 repeats
@fribbledom I realise itβs a bit away from your preferred sources, but it sounds like youβre talking about PowerShell. Default streams are objects, with separate streams for pipe data, errors, output/information, etc. MIT licensed and oss
(DIR) Post #9mCqdDe9fMFvWQPjNY by xeno@mastodon.at
2019-08-24T08:58:50Z
0 likes, 0 repeats
@fribbledom Aside: ip has a --json option :3 β so some tools are getting things like that, but, well, it is not coreutils.
(DIR) Post #9mCrra4lAiOh5pGp5k by uliwitness@mastodon.technology
2019-08-24T09:13:23Z
0 likes, 0 repeats
@fribbledom A while ago I realized there is not even a way to write a C program that returns a hash map/array to whatever shell called it. Would really be amazing to have a standard for that.
(DIR) Post #9mCufoqmiLAjIqohdo by bort@comrades.abortu.com
2019-08-24T07:31:46.320873Z
0 likes, 1 repeats
@rain @Wolf480pl @fribbledom if it's a tool like that outputting the stuff, CSV is probably fine too. My main issue when I used to have to write CSV parsers all the time was huge amounts of CSV containing odd characters and unicode stuff. Those were the cases where I couldn't use off the shelf libraries to do it because they'd crap out. I had to write my own.
(DIR) Post #9mD13HhgCjeLAu892W by kodfodrasz@mastodon.social
2019-08-24T10:56:21Z
0 likes, 0 repeats
@fribbledom I totally feel you. This is why I had high hopes about PowerShell after reading about its concepts. After actually using it I am really disappointed how badly Microsoft has fucked this nice idea up with its terrible implementation.
(DIR) Post #9mD4mI87lUgVOKeUeO by twovoyagers@mastodon.sdf.org
2019-08-24T11:37:14Z
0 likes, 0 repeats
@fribbledom I haven't tried it, but... Nushell?http://www.jonathanturner.org/2019/08/introducing-nushell.html
(DIR) Post #9mD8MmjHm4Z0a67wf2 by nightpool@cybre.space
2019-08-24T12:18:18Z
0 likes, 0 repeats
@fribbledom I mean, powershell is all structured data and it kind of sucks
(DIR) Post #9mDBgKvf92j40vvmGO by iMartyn@boardgames.social
2019-08-24T12:55:24Z
0 likes, 0 repeats
@Wolf480pl @bort @fribbledom simple: comments. When it gets complex I actually use yq which hammers it into JSON and then uses jq to get the info I need and optionally converts it back to yaml.
(DIR) Post #9mDPchkHlpSYyhluKG by carver@fimidi.com
2019-08-24T15:31:39Z
0 likes, 1 repeats
@rain@Wolf480pl @bort @fribbledomThe problem, in my mind, is cross-project coordination. Everyone treats their project as if it were standalone and not part of a software ecosystem. That's fine for smaller projects, but larger ones need to coordinate more or provide reference parsers for their data.
(DIR) Post #9mDas2WLuSnLFclldA by paperdigits@mastodon.social
2019-08-24T17:37:41Z
0 likes, 0 repeats
@fribbledom perhaps nutshell will help: https://www.jonathanturner.org/2019/08/introducing-nushell.html
(DIR) Post #9mDjJXv44swa5GxIoK by CarlCravens@mastodon.xyz
2019-08-24T19:12:16Z
0 likes, 0 repeats
@fribbledom This is what blew me away with PowerShell. Like, how much cooperation between developers would it take to make Linux utils work like that?
(DIR) Post #9mEB62cVvwpDxmcxG4 by ksteimel@scholar.social
2019-08-25T00:23:00Z
0 likes, 0 repeats
@fribbledomThis is probably heresy but have you tried powershell?
(DIR) Post #9mHHK4kvyJhnqBWLui by Xjs@chaos.social
2019-08-26T12:17:27Z
0 likes, 0 repeats
@fribbledom Let's re-build some coreutils in Go :)
(DIR) Post #9mHHU5GEwv8mIow6mu by fribbledom@mastodon.social
2019-08-26T12:19:19Z
0 likes, 0 repeats
@XjsAnything but C or Perl would be fine with me, these days π Go or Rust preferably, yes.
(DIR) Post #9mKFEWTzTePo2GCnei by PastaThief@boardgames.social
2019-08-27T22:37:22Z
0 likes, 0 repeats
@fribbledom One of the things that's been most pleasantly-surprising about learning Powershell (for work) has been how robust its handling of structured collections is.