From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 9064 invoked from network); 16 Jul 2022 16:17:35 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 16 Jul 2022 16:17:35 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1657988255; b=EHF28DHOMqFyfuBAGWBoldQTIYNtE1f8/4JcQQ3xEyESrgESVDmla2OfiAsCMsnH8OE2eD2aIT 6VPLm7kpMWzljwlpb5PjyO3lfS6gJVe6Ja7LNeugQXILCJZaIu8jU/JmQNasGtz1UU84v+EuCd xLhRoLrAhO4tC2z6yeZ/FpI88KQIhcMgKmSgoFXJnUk5ywo+m5lUbAXkscro7YfPvs+OlgHQGi tNaICaziKNtCT+r85kiL+UW0I2C5BKEju8lbLK2rx5qvsFk18ZPAItR/7X5u/r6m0aGQUAxZie ocBflMqSpc5Li1xsz2PI2ocRn2moj0CWKXSnnbVEllUZdg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out2-smtp.messagingengine.com) smtp.remote-ip=66.111.4.26; dkim=pass header.d=ajrh.net header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm3 header.a=rsa-sha256; dmarc=none header.from=ajrh.net; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1657988255; bh=2qjRxPWN023knnwqyF/fPRgOw4dDc4wNwJd76dpcwqE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Subject:To:From:Date:Message-ID:MIME-Version: DKIM-Signature:DKIM-Signature:DKIM-Signature; b=o9HNY0dapmLvEWR4hebOWDxx3cvQ5mC40evlrSKAVoT4ofwlbQZ8AgP2BYczOwWcn0Abo0wj1z E48MQG8gjATX6hQweTMRljIm8Bex2pQoPkJXRyQwV9evb1S3RT+UgA5cObjaultqVgt4B8LGBC F/gIzdb3IqJXWl1KNSxLaF0Z0xiG+9O1CuE6sCc6y3z8++9C8p2y6Pq8zk+rwtvvCvC4lEfiFc 8lOdKJSUg5ZkBJJbCagHTWxk1rNNhPGeRssqt1wtLCNazlYXTelUPxVzL6iL/Ge34CTqifWGdP SbBAKyLKs+ryszAubG/EQDZ49U+yeRLOdH+KvZTm9cbc/Q==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Subject:To:From:Date: Message-Id:Mime-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=hVVqdfwYax2ORwTkmziHwvWJrCZMwHGXI/YR3JfYvOQ=; b=Md7McgTmnM1uit5Srq4imVD/4b OOZuQbEEMPonkM7JwTYmzRy6QaDEtVkvpgJnw2+6fimoVlG71Qbzs6HSWq+rSEfBbu2u+zJIkzlmv tXaYt8raiVXVo3B2DV8hYq/da3gvztwcjWmO3TXt0xIaW/UlqjHE5PKX4BktewdNhzkN9L+TbSEBu XkC5feBW5z2Cccr44KZiEv7DerGLgJ1wbyRrDxgS1WKraNg7M+L4f6UorhB0KLCYvNn2huVz/lv5a cR1cwVCdTcMdlGcrQ/O2QMYhh4gKR5VUbtS33ASb6OE7PiQ0nKDhSvGvGDXTSDCm3X0sLrdHW5WG9 2ox+LWlQ==; Received: from authenticated user by zero.zsh.org with local id 1oCkU3-000FK9-6E; Sat, 16 Jul 2022 16:17:35 +0000 Authentication-Results: zsh.org; iprev=pass (out2-smtp.messagingengine.com) smtp.remote-ip=66.111.4.26; dkim=pass header.d=ajrh.net header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm3 header.a=rsa-sha256; dmarc=none header.from=ajrh.net; arc=none Received: from out2-smtp.messagingengine.com ([66.111.4.26]:54635) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1oCkSr-000EcT-1d; Sat, 16 Jul 2022 16:16:25 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 039FA5C0088 for ; Sat, 16 Jul 2022 12:16:20 -0400 (EDT) Received: from imap49 ([10.202.2.99]) by compute3.internal (MEProxy); Sat, 16 Jul 2022 12:16:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ajrh.net; h=cc :content-type:date:date:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to; s=fm3; t= 1657988179; x=1658074579; bh=hVVqdfwYax2ORwTkmziHwvWJrCZMwHGXI/Y R3JfYvOQ=; b=ABjaXOxy1fMXCLl0fZMNYIUrgGYIQRhtxrk8NXcOm1/7BFqQZ++ kFb7n98NkoEsuIRPip6W6BN0X9PmjnWN+nxrhiQPv8KsnE5bv04XOWoS7muwnUF+ rvIN6gXnuHFlKx5/ycrwBUaxmuQwZYtNd8XSzWSEfJ/cx2zgyOsgrh7DQpNDLeH6 rvk0o1XxMNmv7G40JszYH5JfivuuS6TODFoHaG/o4QWpZehQH7A2xmhVqeNYNLpa heQQNlTF+UJ6mauF0bmpdtM36+JR0giQHExRBpDLnVGWLkYZh0o7Ti4ZgvuNJbYw lZHpG2SvNGhEd/P6tvsxQnGZdpAFT8JHuHg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:message-id:mime-version :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1657988179; x= 1658074579; bh=hVVqdfwYax2ORwTkmziHwvWJrCZMwHGXI/YR3JfYvOQ=; b=M raGHGNnlA47uUR9XbQSDQFQBnpuJ72ZE754fWdmIDqJKHj21Vrj0abMkKIlyttsv 119hPVc/jSxpdtKklxHO7kY6bHsQ3ynNQ4/9jm4bB0JBHXI70RJql/cprl5/Qa01 HA94mzq5FLV5L8MIoBr8y6uIUswnvtukue9EX7C+GDZxr7OpJGY/6zx3xI79fjT+ WQ86h2TgrFuJdaU9x3vszgAgqIFb9p6sVLzxH1g+wsTs9hyNC+TDyo5H2gMCfgBS VpV5x4UaLkbFAbPeSoQrgpXJnfW7GKockJW0T0x7qhGTdtWHzYoWPWZZNVVoIdRA hThjbl8QUyIp8i5vlUXug== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudekfedguddtudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkfffhvffutgesthdtre dtreertdenucfhrhhomhepfdetnhhthhhonhihucfjvggrughinhhgfdcuoegrjhhrhhes rghjrhhhrdhnvghtqeenucggtffrrghtthgvrhhnpeetueelhfettedvhfdthffgiefhje efheeikeettdeigfeijeegleegffdugeethfenucevlhhushhtvghrufhiiigvpedtnecu rfgrrhgrmhepmhgrihhlfhhrohhmpegrjhhrhhesrghjrhhhrdhnvght X-ME-Proxy: Feedback-ID: i6aa94791:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id C13AD15A0083; Sat, 16 Jul 2022 12:16:19 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-755-g3e1da8b93f-fm-20220708.002-g3e1da8b9 Mime-Version: 1.0 Message-Id: <28c00da7-cfdd-4f58-a539-8deebbe5dfa5@www.fastmail.com> Date: Sat, 16 Jul 2022 12:15:48 -0400 From: "Anthony Heading" To: zsh-users@zsh.org Subject: view onto command pipeline? Content-Type: text/plain X-Seq: 27890 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: I'm trying to wrap 'git' in a shell function to better anticipate when I want colour output. Which is probably something like "when run from the command line and outputting to a tty or piped a pager, but not when piped to anything else". The condition seems to make this difficuult post-shell; while most (all?) of the coloured command support an isatty() test, the traditional ways of commandeering that with pty pairs or LD_PRELOAD or whatever seem no use by themselves without knowing more about the pipeline. I vaguely built a solution by ferreting about in /proc and using lsof to follow the stdout chain to identify a pager, but that feels misguided. Is there a zsh way to solve this? Perhaps just by pattern matching on the command buffer to see if it has "| less" toward the end? I couldn't find any shell variables that show the current pipeline string, also found history appears to be written too late to introspect that? I'd be fine to wrap the pager as well, if there is any way to convey some flag backwards up the pipeline... but I think by the time that is evaluated everything is running totally concurrently in different subshells, so probably that can't work.