From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from minnie.tuhs.org (minnie.tuhs.org [45.79.103.53]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 262e575e for ; Wed, 4 Mar 2020 21:56:39 +0000 (UTC) Received: by minnie.tuhs.org (Postfix, from userid 112) id 391919D73A; Thu, 5 Mar 2020 07:56:38 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 807879D71B; Thu, 5 Mar 2020 07:56:10 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=pass (2048-bit key; unprotected) header.d=fastmail.com header.i=@fastmail.com header.b="y0qSspnl"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="BoVJbwcX"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 5F48F9D71B; Thu, 5 Mar 2020 07:56:07 +1000 (AEST) X-Greylist: delayed 309 seconds by postgrey-1.36 at minnie.tuhs.org; Thu, 05 Mar 2020 07:56:06 AEST Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by minnie.tuhs.org (Postfix) with ESMTPS id A68099D68F for ; Thu, 5 Mar 2020 07:56:06 +1000 (AEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id B511322025 for ; Wed, 4 Mar 2020 16:50:55 -0500 (EST) Received: from imap35 ([10.202.2.85]) by compute1.internal (MEProxy); Wed, 04 Mar 2020 16:50:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= mime-version:message-id:in-reply-to:references:date:from:to :subject:content-type; s=fm2; bh=znEXXqMVpezClLt0/sls7w4oayecwBA Iu+OhSZZHOvk=; b=y0qSspnlOfJkgWS3M2j6c27hVmQcbZeyWLWeEQwHuzP6USl QJfNVqQAIOjLyPH6cFH8rwxhFtkqycDiKQDR1YEqlz4n7Qa7MTMOPphA2wFwUsK0 P9TFXOYjv1yOkhJaJQ3hsqpMwaun5V6IWtFTCKIZw6/Heol5hkjnAZNE6HvHDYPv UT4Dom9YWfes9QihIU94c3DVW8zW0E5Foi7Ome6nnITqblLmF5EhsLgVn1on/tEx 5Mdv66FWMngorXLZgH1MV3NoTku5leESzseL9+KjTp4jm9RI5APpJiRhSMn9T472 9k62hGKHbKVfwXRFXrB3lu8RKZEVVdfHDmT/SJg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=znEXXq MVpezClLt0/sls7w4oayecwBAIu+OhSZZHOvk=; b=BoVJbwcXzCKYHVhsObMrhT PFUKIP76FjFvGuVATOYLcdvHJvbB6xvNeHgOaTCqwbH5ePdRN7Tus+IOaf7fJkeu 53gHxq92kpE3Y2mpO3ztO0BQ1zPVown5Q/mpURnds0vnnrLJKgqQjgvllgCXQJRd ryQ1PJEx3TaWwkTZ+7WcSBkuilVEwKMXDaLMeA3VMX5x73ApKthzKTKDTW0m77DA oyaQMDwjWPIw6WmAk0CNWG8q/5CS5zjMStVYvInF0FGVS8/QUaKbGN6Hu++OBkRJ U77nhh1ifqToJBb3XVx0/O9taW4nLeQWKel0D9NUO9hQr0G+5erku8olnBTH4SUg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedruddtkedgudehfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpeftrghn ughomhekfedvuceorhgrnhguohhmkeefvdesfhgrshhtmhgrihhlrdgtohhmqeenucffoh hmrghinhepuggrnhhluhhurdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomheprhgrnhguohhmkeefvdesfhgrshhtmhgrihhlrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 5DB3614C0575; Wed, 4 Mar 2020 16:50:55 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-986-gfc2d493-fmstable-20200304v3 Mime-Version: 1.0 Message-Id: <5019a751-d69a-4839-9a56-b977b275070d@www.fastmail.com> In-Reply-To: References: <202003031815.023IFSlD493028@darkstar.fourwinds.com> Date: Wed, 04 Mar 2020 16:50:34 -0500 From: Random832 To: "Grant Taylor via TUHS" Content-Type: text/plain Subject: Re: [TUHS] Command line options and complexity X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" On Tue, Mar 3, 2020, at 13:44, Adam Thornton wrote: > I've heard people say that there isn't really any alternative to this > kind of complexity for command line tools, but people who say that have > never really tried the alternative, something like PowerShell. I have > plenty of complaints about PowerShell, but passing structured data > around and easily being able to operate on structured data without > having to hold metadata information in my head so that I can pass the > appropriate metadata to the right command line tools at that right > places the pipeline isn't among my complaints3 > . > > Somewhat disingenuous. I mean, yes, that's true, but on the other hand > it means that you have to keep the "what Powershell commands operate on > what structure" in your head instead, since you can no longer assume > the pipelines to be a universal interface. Sure, but "stdin is a sequence of any type, and the argument is an expression that operates on that type or the name of a property that that type has" is universal enough. The part that has to operate on a specific structure isn't the command, it's the arguments. For example, a powershell pipeline to produce a list of files sorted by modified date is: gci . | sort lastwritetime | select name all three *commands* are universal - not all objects have a "lastwritetime" and "name" property, but sort and select can operate on any property that the sequence of objects passed into it has. (gci is an alias for get-childitem... it also has aliases ls and dir, but I'm emphasizing that it's not exclusive to directories) *assuming that ls -t didn't exist*, to do this with unix tools that operate on text you would need: ls -l | [somehow convert the date to a sortable format, probably in awk] | sort | [somehow pick the filename alone out of the output - possibly with cut or sed or awk again] and it's very difficult to get tools like awk, sort, and cut to work on formats that contain more than one field that may contain embedded spaces (you can just about get away with it for ls output because the date is always three "words"). A significant portion of ls's options are related to sorting, because you can sort based on fields that are either not present in the output, or are not in a format that can be sorted textually. Maybe it would be enough to have the universal interface be "tables" (i.e. text streams in some format that supports adequate escaping of embedded row and column delimiters)... or maybe even just table rows, and let the user deal with memorizing column numbers (or let each originating command support a fully general way to specify what columns are requested, as ps alone does on modern systems) Of course, this isn't *really* different from allowing any data structure - after all, the value for any field could itself be a fully escaped table in text format. The benefit of having actual data structures with types is that when you *don't* end the pipeline with select, each object knows how to print itself [files print mode, mtime, size, and name in a human-readable format, more or less equivalent to ls -l] rather than just dumping out every single field that you might want sort or select to operate on.