From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9444 invoked by alias); 3 Sep 2018 14:07:14 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23604 Received: (qmail 27375 invoked by uid 1010); 3 Sep 2018 14:07:14 -0000 X-Qmail-Scanner-Diagnostics: from out1-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.25):SA:0(-2.6/5.0):. Processed in 0.499732 secs); 03 Sep 2018 14:07:14 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=1MojDc M3LkckL5z4acc4BMmbU3/JLtRK/4ib1OCjHgM=; b=K+jNuUuNfPKdbaRJUWvZgf G0IYaBpcco0BEAhVvE1HwvOInfbiwnkQDwJ+MBaZ6ruTc9C36HPs+GxyhmXEob20 REVG8TCieNbXlFFwkov3D6pKFyfA2/GfKKjUihwaf3P6iSPuT49WFAuckG8Dz76W uOVetgGoJBVmj6HjHj+9eXJ8UudEQ0l6MiV+496hYRrRd1H8TThtGwghd0/W8/ZA bfObxmODbo1qGi0zDVlVZLBvgSpbR8XsLi+6QcGPQZT1GUwLoaapgDkFAblTdCaf QO1rYADodjFaQrR4rIjWBBguqm3+vnrb1cYizIiCpLwKzF8saTAPQO4/E7O5MnGQ == DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=1MojDc M3LkckL5z4acc4BMmbU3/JLtRK/4ib1OCjHgM=; b=IJCxh2A+gb/yB2FZzqphK8 KEoIhlgiEX7KA2EdChpBb4tdfLXpg989s3M1FyOfbu6YsMfO+tSmBK6epITnv0MT 27mIVK2a4VB78mSXbojxDFYF8Y+NsXc/+68dfGdFQTgrVQ4F1E2Hl8kEN4zpSUpC knHTsH0sIoBzQ76B5L0uVycKrTznxuG/bu+VE1COsXc75BddmnJpqIFzRXGPqu+i VApu4dzB2TQac3w9SHgffHUvSEZXscyIPEegTF+WXV6zezC8+CeFpzZWTtLgFiVt tjNpvioxJwuyKWYZya0BNiMyYZNSe9PAB2jDt8WQh7iNhA3Lfil762NeHsbRHWKg == X-ME-Proxy: X-ME-Sender: Date: Mon, 3 Sep 2018 14:07:09 +0000 From: Daniel Shahaf To: Zsh Users Cc: Leonardo dos Reis Gama Subject: Re: Subcommand dispatcher and alias factory Message-ID: <20180903140709.d5u6qvx63j6vi3nf@tarpaulin.shahaf.local2> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Bart Schaefer wrote on Fri, Aug 31, 2018 at 16:01:25 -0700: > the shell MUST first execute "git". Unless all commands with > subcommands were to share some standard exit status or error message > that would allow the shell to discover that the reason for failure was > that the subcommand is not found, the shell has no generic way to know > why the primary command failed in order to try it again differently. > You can program it separately for each command that has subcommands, > as was shown in examples in a couple of the links you mentioned. > I don't understand what's so bad about subcommands. What's different between, say, «git ci -S foo» failing because 'git' doesn't know the 'ci' subcommand, and that command failing for any other business logic reason (e.g., 'foo' being an invalid argument)? > This, by the way, is why commands with subcommands are basically > horrible, and a perversion of the UNIX command model. It's like > creating a custom shell within the shell. Which latter is fine if you > tell the user that's what you're doing (I was one of the major > contributors to a custom shell for managing email, back in the day), > but in the git-style incarnation always grates on me in the same way > that layering violations in object-oriented programs do.