The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Larry McVoy <lm@mcvoy.com>
To: Rob Pike <robpike@gmail.com>
Cc: The Eunuchs Hysterical Society <tuhs@tuhs.org>
Subject: Re: [TUHS] Warner's Early Unix Presentation
Date: Sat, 8 Feb 2020 16:19:30 -0800	[thread overview]
Message-ID: <20200209001930.GF21264@mcvoy.com> (raw)
In-Reply-To: <CAKzdPgxZXp24KK5D06x1sgh3HS5xZqxbDwY5N7SipDaoBvX0LQ@mail.gmail.com>

> In today's Unix (I use the term loosely) world, the phrase "free of
> decoration" is apostasy.

Yeah, it's annoying.  When I was building my last big system (BitKeeper)
I "solved" the problem by having -s (silent) as an option to pretty much
every command that produced output.

In terms of controlling output, we took the SCCS keywords on steriods,
we evolved it to sort of a little programming language.  I was told
that "bk changes" (think git log sort of) couldn't be taught to produce
JSON output.  Oh, it can't huh.  Below is the input that tells it to do
just that.  It's sort of awk like, control words are $word,  "quoted stuff
is printed, :THING: means print whatever THING is, variables are $0 .. $9
and eval to "" or 0 in numerical context.  The main body script, much like
awk calls it on each line, the script is called on each commit (and it 
optionally recurses into files as well).  I'm pretty proud of it, it
works really, really well.

$ cat `bk bin`/dspec-changes-json
# dspec-v2
# The default dspec used by 'bk changes -json'

$begin {
	"[\n"
}

$if (:CHANGESET: && !:COMPONENT_V:) {
	$if($0 -eq 1) {
		"\},\n"
	}
	"\{\n"
	"  \"key\": \":MD5KEY:\",\n"
	"  \"user\": \":USER:\",\n"
	"  \"host\": \":HOST:\",\n"
	"  \"date\": \":Dy:-:Dm:-:Dd:T:T::TZ:\",\n"
	"  \"serial\": :DS:,\n"
	"  \"comments\": \"" $each(:C:){$json{(:C:)}\\n} "\",\n"
        $if (:TAGS:) {
             "  \"tags\": [ "
             $each(:TAGS:){:JOIN:"\""(:TAGS:)"\""}
             " ],\n"
        }
        "  \"parents\": [ "
            $if(:PARENT:){"\"" :MD5KEY|PARENT: "\""}
            $if(:PARENT: && :MPARENT:){," "}
            $if(:MPARENT:){"\"" :MD5KEY|MPARENT: "\""}
            " ]\n"
	${0=1}		 		# we need to close off the changeset
}

$end {
	$if($0 -eq 1) {
		"\}\n"
	}
	"]\n"
}

  parent reply	other threads:[~2020-02-09  0:19 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-07 22:25 Warren Toomey
2020-02-07 23:57 ` Rob Pike
2020-02-08  0:43   ` Warren Toomey
2020-02-08  3:37     ` Warner Losh
2020-02-08 15:15   ` Warner Losh
2020-02-08 21:50     ` Rob Pike
2020-02-08 22:29       ` Chet Ramey
2020-02-08 22:54         ` Rob Pike
2020-02-08 23:02           ` Chet Ramey
2020-02-08 23:11             ` Rob Pike
2020-02-08 23:13               ` Rob Pike
2020-02-08 23:21               ` Kurt H Maier
2020-02-08 23:26                 ` Rob Pike
2020-02-08 23:28                   ` Chet Ramey
2020-02-08 23:26               ` Chet Ramey
2020-02-08 23:29                 ` Rob Pike
2020-02-08 23:35                   ` Warner Losh
2020-02-08 23:36                   ` Chet Ramey
2020-02-08 23:54                     ` Rob Pike
2020-02-09  0:11                       ` Chet Ramey
2020-02-09  0:19                   ` Larry McVoy [this message]
2020-02-08 22:31       ` Richard Salz
2020-02-10 13:18       ` Tony Finch
2020-02-10 15:05       ` Dan Cross
2020-02-10 15:46         ` [TUHS] V9 shell [was Re: Warner's Early Unix Presentation] arnold
2020-02-10 18:39           ` Rob Pike
2020-02-10 18:59             ` Bakul Shah
2020-02-10 19:58             ` Angelo Papenhoff
2020-02-10 20:11               ` Chet Ramey
2020-02-11  9:33             ` arnold
2020-02-11  9:47               ` Noel Hunt
2020-02-11  9:47               ` Rob Pike
2020-02-11  9:59                 ` Rob Pike
2020-02-11 17:05                   ` Steffen Nurpmeso
2020-02-11 17:18                     ` Arthur Krewat
2020-02-11 18:22                     ` Kurt H Maier
2020-02-16 21:34                       ` Wesley Parish
2020-02-11 18:26                     ` Jon Steinhart
2020-02-11 23:56                       ` Steffen Nurpmeso
2020-02-12  0:12                         ` Jon Steinhart
2020-02-12  1:03                           ` [TUHS] V9 shell Warren Toomey
2020-02-12  5:54                           ` [TUHS] V9 shell [was Re: Warner's Early Unix Presentation] Rob Pike
2020-02-11 17:36                   ` Dan Cross
2020-02-11 18:35                   ` Christopher Browne
2020-02-11 18:54                     ` Rob Pike
2020-02-11 21:36                     ` Harald Arnesen

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

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

  git send-email \
    --in-reply-to=20200209001930.GF21264@mcvoy.com \
    --to=lm@mcvoy.com \
    --cc=robpike@gmail.com \
    --cc=tuhs@tuhs.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.
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 NNTP newsgroup(s).