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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 9957 invoked from network); 20 Jul 2022 19:28:29 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 20 Jul 2022 19:28:29 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1658345309; b=j1E+HFuE0hxQ9uq4u8lOdmd9U/JkuaOC91bBB+G3Y9Xqn7LH+y84b1BL1ZFfO3Mnb7csbhlBhv sr+6+mZBqrGbHaC5KJQS5c0UuI6//7aYwvs1izD5cIZ05OiVvL12+qP1O6ksUONokWvKTdm5XD FxL9N9t5M7AD9CNxrTu5JFZMMBsbR/Quy2cFIes2jHP2qwxXKDkVcDIJapUok9G1n01x1LIpVT bamjAqyd0ijTAHwTrK9pYLJn2yWdUxcCEAhUXJNlHHXsJKi21JsIwNJ834c5JpRsGwUFkc+kuP YlU+cWHYVmRkp+pnlF6ZipSZohf/ciBFo0JFO6KElwiL5g==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mx.spodhuis.org) smtp.remote-ip=94.142.241.89; dkim=pass header.d=spodhuis.org header.s=d202202e2 header.a=ed25519-sha256; dkim=pass header.d=spodhuis.org header.s=d202202 header.a=rsa-sha256; dmarc=pass header.from=spodhuis.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1658345309; bh=JgDJc0nl1aV3HQnkGVN1Gq0Pc4wkGftHi/ZeQOMkWwQ=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:To:From:Date:DKIM-Signature:DKIM-Signature:DKIM-Signature; b=LbRBFk0raT4nx1ktZfgSBbTkwBYRUDhu0KnPuRiHaz6JpzjR4xoIDuglpzd+vNsTKCLKbijmtM 5MuXHu4hPC9b20zYf3yMZBnFPzAwIWknMGgxjhqMQbBiAC5Jx66N8PRs3fcjgXqWu9mjYJzlsh kbj0dqC8i1mXSqOmZngGkLRQO7QpIsCFmSk8mFwlNAW2m6k0BDRV8gKxOOL3ZFd5vFi19jUygQ k7nQjZm4kBfiqffD2vlz4GKQRC8+KPC7u5LujyiPJNPGFb+3gqt94c/ZrWgCKtLXHFRx822UhB uEjjo/u6SwHaFvM6R3jLbUa1em1n8oRK1ZjhvW8KYeAdkw==; 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:In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:To:From:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=OQBBOJmCuv3xDPfJ0/JG7UsaV6/w41MR4UMH65p4bO0=; b=oxeEBIWdGIJZVjUWcYJryMgaZB XGbUSAdYM22EW9FjpbI1nKAAy3AMFJP3dIIhVKw1WUOXGIoHsFDPvK73ze3aB+TTjhR9Ig3GAnneM XJUMbxT63ftVthNAmdK/uKDy8AEEWb5oakiZuYSheFmVSDVqiBWXMDF9kqJHnCnroOLnivaE6h5/A XhcA7O6TiZL6qdOOJGD6KOJ2gaUX32SkvbzPHwbdeNnTTZIaMz6NAe/W591QBatvPt1tEVmuUQkhE 4R2PgTvJcchtEMLlVh/xW2yuKiNmVxt4gjjdvkuR4uyd5yFkNTBM/NVtzxOx+90OxXIHXmE1FMtTW J6Ag1pPA==; Received: from authenticated user by zero.zsh.org with local id 1oEFMz-000NUj-DY; Wed, 20 Jul 2022 19:28:29 +0000 Authentication-Results: zsh.org; iprev=pass (mx.spodhuis.org) smtp.remote-ip=94.142.241.89; dkim=pass header.d=spodhuis.org header.s=d202202e2 header.a=ed25519-sha256; dkim=pass header.d=spodhuis.org header.s=d202202 header.a=rsa-sha256; dmarc=pass header.from=spodhuis.org; arc=none Received: from mx.spodhuis.org ([94.142.241.89]:52203) (DNSSEC AD) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1oEFMC-000MnZ-0C; Wed, 20 Jul 2022 19:27:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d202202; h=OpenPGP:In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:To:From:Date:From:Reply-To:Subject:Date:To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:OpenPGP:Organization :Auto-Submitted; bh=OQBBOJmCuv3xDPfJ0/JG7UsaV6/w41MR4UMH65p4bO0=; t=1658345259; x=1659554859; b=Ta8IWI6xGIaAgNfxwiopUtJbjD1ZIGXhPm6diBu6AVVAZbT rEvPUmVX/3ycDkOg/5QyoFHhDwdktThxwX/8QnBi0Lbg7DgPUcjyF9QFrMDyDyRaEPU0MUcCPjbwC HcH5tBaSMyAp9OX35gNXHxhwyj/kkSzWrot403IOr94fpwz25PhhYaE72gKQ39+9db/h8i5VXITnT KWDfLOg/88D9lD98d8ala/inrBNVlcWFy8BIOoXP5YOzqcrFIx+LQGVnwt6vNHGcdAicz4bq4caXj mJPBNN6+skG4f1FdtOEBubNOX2e7oHu7Avt6UOhx1RoGQoN12mW3yjb+7GHdcPVg==; DKIM-Signature: v=1; a=ed25519-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d202202e2; h=OpenPGP:In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:To:From:Date:From:Reply-To:Subject:Date:To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:OpenPGP:Organization :Auto-Submitted; bh=OQBBOJmCuv3xDPfJ0/JG7UsaV6/w41MR4UMH65p4bO0=; t=1658345259; x=1659554859; b=UI5ThI/GTvEFTA0a4PJ+jKvMiELppSwfxinWTPkGGyJvZQM UeuKFgM7k/FdE28DJHqsdMSxoaKHRNkljoxQfAQ==; Received: from authenticated user by smtp.spodhuis.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1oEFMB-000MnT-Dz; Wed, 20 Jul 2022 19:27:39 +0000 Date: Wed, 20 Jul 2022 15:27:36 -0400 From: Phil Pennock To: zsh-users@zsh.org Subject: Re: view onto command pipeline? Message-ID: References: <28c00da7-cfdd-4f58-a539-8deebbe5dfa5@www.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: OpenPGP: url=https://www.security.spodhuis.org/PGP/keys/keys-2013rsa-2020cv25519.asc X-Seq: 27907 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: On 2022-07-20 at 07:23 -0400, Anthony Heading wrote: > On Sat, Jul 16, 2022, at 5:30 PM, Bart Schaefer wrote: > > You need to look at the preexec hook. > > Ah, many thanks Bart! Much appreciated. Don't know how I missed that. > > For the record, I used just the following, and it works great. > > git () { > local opts=() > if [[ -o interactive && ( -t 1 || -n $pager ) ]] > then > opts=(-c color.ui=always) > fi > command git $opts $@ > } So, "if invoked from shell, use color if stdout is a tty, otherwise don't". Since ancient Git (1.8.4) automatic-based-on-tty is the default, so you'll need `git config --global color.ui false` run to populate your gitconfig file to disable color normally. The shell wrapping is simply: function git { command git -c color.ui=auto "$@" } and only define this for interactive shells, so in .zshrc or the like, not .zshenv. -Phil