From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,RDNS_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 Received: (qmail 16517 invoked from network); 25 Mar 2020 23:18:05 -0000 Received-SPF: pass (primenet.com.au: domain of zsh.org designates 203.24.36.2 as permitted sender) receiver=inbox.vuxu.org; client-ip=203.24.36.2 envelope-from= Received: from unknown (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTP; 25 Mar 2020 23:18:05 -0000 Received: (qmail 1870 invoked by alias); 25 Mar 2020 23:17:54 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45618 Received: (qmail 5259 invoked by uid 1010); 25 Mar 2020 23:17:54 -0000 X-Qmail-Scanner-Diagnostics: from wout4-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25758. spamassassin: 3.4.2. Clear:RC:0(64.147.123.20):SA:0(-2.6/5.0):. Processed in 4.510769 secs); 25 Mar 2020 23:17:54 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudehhedgtdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfgjfhfogggtgfesthhqtddtredtjeenucfhrhhomhepffgrnhhi vghlucfuhhgrhhgrfhcuoegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvgeqne cukfhppeejledrudejiedruddvhedrvdefvdenucevlhhushhtvghrufhiiigvpedtnecu rfgrrhgrmhepmhgrihhlfhhrohhmpegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrg hmvg X-ME-Proxy: Date: Wed, 25 Mar 2020 23:17:10 +0000 From: Daniel Shahaf To: Ross Goldberg Cc: zsh-workers@zsh.org Subject: Re: Adding builtin command option aliases Message-ID: <20200325231710.60c57e25@tarpaulin.shahaf.local2> In-Reply-To: References: X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Ross Goldberg wrote on Wed, 25 Mar 2020 15:21 -0400: > Would you be willing to add option aliases to builtin commands to align > with other shells, like bash, so that scripts will be more easily portable > across multiple shells? Implementing this doesn't require any changes to zsh itself. There's nothing stopping you from writing a =C2=ABread() { =E2=80=A6 }=C2=BB functi= on that wraps zsh's builtin =C2=ABread=C2=BB and supports bash's native options _instead = of_ zsh's options (even where option letters have different, incompatible meanings between the two shells). You could even package that function and others like it as a "zsh for bash speakers" shim library, enabled by a one-line idiom such as =C2=AB[[ -z $ZSH_VERSION ]] || autoload -U bash-sh= im=C2=BB. The "modernish" library might be useful too. > e.g., bash read has the -a argument, while zsh read has -A. They seem to > do the exact same thing. It's a shame that a script needs to detect which > shell is running to determine which option to use. Are you thinking of scripts or of plugins? Scripts should target either bash or zsh but not both, just like scripts target either Perl or Python but not both. Nobody writes programs that can execute under either Perl or Python depending on what their users have installed; same for bash and zsh. On the other hand, for plugins (=3D code that runs in interactive shells) it can make sense to try to support both bash and zsh in order to benefit from economies of scale. > Providing such interoperability might increase the number of zsh users, a= nd > ease the transition for macOS 10.15+ & other users macOS 10.15 users who are used to bash should just install bash and change their scripts' #! lines appropriately. Cheers, Daniel