From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5857 invoked by alias); 18 Dec 2017 09:39:43 -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: 23009 Received: (qmail 29179 invoked by uid 1010); 18 Dec 2017 09:39:43 -0000 X-Qmail-Scanner-Diagnostics: from aok120.rev.netart.pl 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(85.128.245.120):SA:0(-1.9/5.0):. Processed in 3.497079 secs); 18 Dec 2017 09:39:43 -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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: psprint@zdharma.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Virus-Scanned: by amavisd-new using ClamAV (7) Date: Mon, 18 Dec 2017 10:39:33 +0100 From: Sebastian Gniazdowski To: Zsh Users Message-ID: Subject: Feature request: a command launcher X-Mailer: Airmail (442) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello I came up with a feature that could be called =22services=22. It's about = defining a widely understood environment for a specified command. The poi= nt is that =22environment=22 doesn't only mean: exported variables, but a= lso: redirections, working directory, use of sudo, command arguments, etc= . Present solutions like direnv/direnv handle only environment variables.= A definition of service could look like this: =23 =23 Definition of a service that builds Zsh located at =23 =7E/github/sfzsh3, with -O2 and pointers to libgdbm. =23 =23 This file is for configure script. =46ile sfzsh3make =23 is for running make, and is triggered automatically =23 by this file =23 integer disabled=3D0 local command=3D=22./configure=22 local arguments=3D'--enable-unicode9' integer spawn=5Ftype=3D0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=23 available: disown= , fork, subshell, coproc, zpty, nohup; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =23 can combine to some extent, e.g. =24(( fork = =7C disown )) integer run=5Fmethod=3Dcommand =C2=A0=23 available: command, autofun, sou= rce local stdin=3D=22=22 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=23 = no redirection local stdout=3D=22/dev/null=22 local stderr=3D=22=22 integer sudo=3D0 local run=5Ffirst=3D=22=22 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=23 no servi= ce to run first local run=5Flast=3D=22sfzsh3make=22 =23 run sfzsh3make after this service= local workdir=3D=22=24HOME/github/sfzsh3=22 integer cd=3D1 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=23= stay in =24workdir after this service finishes local -A env env=3D( =C2=A0 =C2=A0 C=46LAGS =C2=A0 =C2=A0 =C2=A0=22-g -Wall -O2=22 =C2=A0 =C2=A0 CPP=46LAGS =C2=A0 =C2=A0=22-I/usr/local/include=22 =C2=A0 =C2=A0 LD=46LAGS =C2=A0 =C2=A0 =22-L/usr/local/lib=22 ) Then, to compile Zsh, one would issue: zsrv build=5Fsfzsh3. =22zsrv=22 is= hard to type, the name should be better. Someone might ask: why not create a script that holds complete configure = command and make invocation. So why e.g. OS X does the definition-way for= its services, it could just create and collect scripts ;) I'll limit to = just this: the definition is just a series of parameter assignments, it's= like separating data from presentation (XML vs. HTML). All this is a sub= tle, but still a paradigm-shift. I'm worried about how many use cases would this have. Above =22Zsh buildi= ng that doesn't need history-dig, cd and parsing 'is it -O0 or -O2, what = did I run last time'=22 is a good use case. But are there more use cases,= has someone ideas=3F I came up with this idea for Zplugin, but decided to ask in feature-reque= st style, because I really think that Zsh would gain from such feature. A= nd I'm curious of possible code and alterations. But I also need feedback= if this looks useful or not. -- =20 Sebastian Gniazdowski psprint /at/ zdharma.org