everything related to duct tape audio suite (dtas)
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: dtas-all@nongnu.org
Subject: Re: Line wrapping in YAML output
Date: Tue, 16 Jun 2020 04:19:38 +0000	[thread overview]
Message-ID: <20200616041938.GA7549@dcvr> (raw)
In-Reply-To: <20200615111727.yn23ntg6spxa7ft4@gmail.com>

James Rowe <jnrowe@gmail.com> wrote:
> * Eric Wong (e@80x24.org) wrote:
> > James Rowe <jnrowe@gmail.com> wrote:
> > >   I routinely find myself needing to use a “real language” when I want
> > > to perform a quick hack with dtas purely to workaround the default line
> > > wrapping in YAML output.  With unwrapped output sed/awk would often be
> > > a viable solution from the shell prompt.
> > 
> > Understandable.  Do you use dtas-ctl or some other socket tool?
> 
>   Pretty much always parsing dtas-ctl, because I hardly ever seem to
> have a {nc,socat}-style tool with SOCK_SEQPACKET support.

It's not well-documented, but socat supports setting type= to
the numeric value of SOCK_SEQPACKET.  At least on Linux,
SOCK_SEQPACKET is 5 (ruby -rsocket -e 'puts Socket::SOCK_SEQPACKET'):

  echo current | socat UNIX-CONNECT:$HOME/.dtas/player.sock,type=5 -

> > On the flip side, one of the reasons I picked YAML over JSON is
> > the indented + wrapped-by-default nature made it
> > $EDITOR-friendly.
> 
>   I hadn’t thought it through all that much, which is why I was asking
> about possible drawbacks.
> 
>   You’ve pushed me enough to think that dropping a yaml2json¹ script in
> ~/bin would often be enough for many of my use cases.  That simple
> change would allow fancy jid²/jq³ support along with hacky sed/awk
> scripts.

Cool.  Fwiw, I also just found "yq" looking for a jq-like thing
for YAML: https://kislyuk.github.io/yq/

I haven't tried yq, and have no plans to: I prefer to avoid
software unless it's been in Debian for a while.

> > >   Given that psych supports an options mapping where setting
> > > ``line_width: -1`` disables wrapping entirely, I’m wondering if there
> > > would be support for disabling the line wrapping.  I’m also wondering if
> > > I’m missing some drawbacks to doing so.
> > 
> > My patch below seems to work.  The dtas-*edit tools had to be
> > updated for $EDITOR-friendliness.
> 
>   Oh wow, thanks!  WFM, but I’ll add that I didn’t expect you to do the
> work ;)

No problem,  I was curious how long much effort it took and
it wasn't much, at all.

> > dtas-ctl output could become difficult-to-read on the terminal;
> > maybe it could detect stdout is a terminal and rewrap in that
> > case.
> 
>   I’m not really a fan of fiddling with behaviour on isatty(), as it
> quietly changes behaviour when you’re perhaps not expecting it.  Lots of
> tools do it though, so perhaps it is just me.

Yeah, it's a bit surprising sometimes.  I often run commands in my
$EDITOR buffer and it wouldn't help that case.

>   So… I’m not unsure whether I still want this change.  There are

"not unsure"?  Based on the rest of what you've written,
I think you meant just to write either "unsure" or "not sure"?

> workarounds with few drawbacks, and nobody else appears to have
> complained in the previous seven years about this.

AFAIK, you're maybe the 3rd user of this? :)

I'm not exactly good at promoting software and have no plans
to break out of my introvert comfort zone  :>

Anyways, I'm not inclined to change this, either; since
reformatting YAML or converting to JSON is pretty easy
in Ruby/Perl/Python.


  reply	other threads:[~2020-06-16  4:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-13 15:25 Line wrapping in YAML output James Rowe
2020-06-15  0:24 ` Eric Wong
2020-06-15 11:17   ` James Rowe
2020-06-16  4:19     ` Eric Wong [this message]
2020-06-16  9:53       ` James Rowe
2020-06-28 23:39         ` Eric Wong
2020-09-23 10:37           ` James Rowe
2020-09-25 19:14             ` Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://80x24.org/dtas/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200616041938.GA7549@dcvr \
    --to=e@80x24.org \
    --cc=dtas-all@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/dtas.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).