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 19100 invoked from network); 12 Sep 2021 01:27:58 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 12 Sep 2021 01:27:58 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1631410078; b=hBb+ElcJjoDVY6EJmkGFFUy+DkBIwHIcZwj4cvlNRvUockNK3kVys0/8loShvL7EEYqqZfQVgy tVGHSlGfl6qkcoVpf57Fq/X5exTJO6l+mQ2q//nQ4KWmMHfG44SqemNWFV6Nwaa2DPRx5EKBQ8 +XuBP2IsVG+WhT5iaQFTeJAsKlfnx6qJefCx+i3yJRuEOEVbmvzv8D7Awo4h/0olo4IRyeof+C PewSYa8VuNopZTSypZODMDRMnnjQJeHt/h4o6MutAGQtZgQO5eyXLiUJ4V7UBeQox8SOrRdHGi l5DpEXj8k0EwUidmSHF5X7rH5PCegIao44I27wmI7IczQw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (email.dondley.com) smtp.remote-ip=34.203.132.18; dkim=pass header.d=dondley.com header.s=default header.a=rsa-sha256; dmarc=pass header.from=dondley.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1631410078; bh=z8kSN+i6izqUgMJUKlaZjD5hMwfx9vsmyuFMbXgS+gM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Message-ID:References: In-Reply-To:Subject:Cc:To:From:Date:MIME-Version:DKIM-Signature: DKIM-Signature; b=Gzwgqko0uYDWoyXiLd8LqjXtqfUtsH7QLALoIPKKE88s0WW/L0Pty8XkB2v4RLOzpUM2G+f75w ddeWkRKicz+Q+9yotdVJionzgTa3EWh1W+sMi4kNr1Y2GKR8lCa3J1xlENLcdGKTG7nO0NE+hZ NTFQMZM/psZe++f3oPtNQNaHPR3Wrx7C7xVx22k5ch8OESrf1/nvznjQywpH+qeB7q3bx+zjY7 pQzOekBM3e3P63RsBhjl+aw6BXb5Gtr2olkBFfOGEKxs7g4Wq+8VTZQQLo5nXOTNyCbrqdatzn giuqh5a+69J3L97Eza5msLIXTQgsiBfITFBuNkgdyaxpRA==; 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-Transfer-Encoding: Content-Type:Message-ID:References:In-Reply-To:Subject:Cc:To:From:Date: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=BQgNuB6qh000fbAS5Hiu3yeCsBbPOkPOuc9MS+6xYSY=; b=oAn4opwuUddF453/m4VlICwpd7 kfLzrYKWxIBzpLLJtqx76lXDwLV2IAwf7YnBZriYoF5SbtNDItUvzOFIg9pXgW0m81T8AbeJepdPO 5vwrOkjuM8ZaFFCL4AJqbesxrsB5r/TSyhWEhvJmq9YKnggp7UHTuj6jsnCJQfTtIIZbMDMifomwH tiNZAfGHN+59vM5ExuHTPuTLPArzxOFiO5l9y/NetGli1XeGhNbDS6OBbNZMMHMLyA/zqXSYsz+cs EbS7H8zgYvscfFjhcgrd2rUpTrbQRt90dK+JdLTV0Q3OG3qSAPyYvx/iBUgYx3Hq4M48ypN1y1hZ0 pR5U0mlQ==; Received: from authenticated user by zero.zsh.org with local id 1mPEHl-000FUi-Ho; Sun, 12 Sep 2021 01:27:57 +0000 Authentication-Results: zsh.org; iprev=pass (email.dondley.com) smtp.remote-ip=34.203.132.18; dkim=pass header.d=dondley.com header.s=default header.a=rsa-sha256; dmarc=pass header.from=dondley.com; arc=none Received: from email.dondley.com ([34.203.132.18]:33502) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mPEH4-000ElW-5d; Sun, 12 Sep 2021 01:27:15 +0000 Received: from email.dondley.com (email.dondley.com [34.203.132.18]) by email.dondley.com (Postfix) with ESMTPSA id 8015720157; Sat, 11 Sep 2021 21:27:11 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=dondley.com; s=default; t=1631410031; bh=z8kSN+i6izqUgMJUKlaZjD5hMwfx9vsmyuFMbXgS+gM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=eB+5Dj4tToTlMu16Pp1z7rHbHA1g7GJbxm0f1YnMEJyEHVGQirXoKlERah20QKkVQ 64UpGJupmz12tMzQiLdrP8X2WYfKt903LN6L5kJdApyzeXgT4y55WnTMO6k2eB+/er dx4XVgpIv79FlyKBvpOuySF1+KdfhNbz1Lc05VAm16SJiVrxJNW8A9TNKV7QMkZ051 ThV5a3R9tDTm09FXgUE1pfc+zJ9m5KGvTtalXguHXVHm6tFFuneJ1dk2XH+swL1d40 E/keTl7JV6FQtWc0P4cFXLBWUqI0yrEmRjbJShhLxOz4WEkNQFd6nwXnPcJAaQFlgQ K2/0wsJjHO08w== MIME-Version: 1.0 Date: Sat, 11 Sep 2021 21:27:10 -0400 From: Steve Dondley To: Bart Schaefer Cc: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= , Zsh Users Subject: Re: Is there any possible way to automatically escape characters when executing an alias in zsh? In-Reply-To: References: <8432871497e50ae7a6136a9e03a09ad6@dondley.com> <4df9fd0786c03076984bfd7d5cccc34c6780f519.camel@ntlworld.com> <01fed731885d32a336c7b0f31c8f4156@dondley.com> <88e7249e-09d7-4fc2-8b7f-d9e00c86f44f@www.fastmail.com> User-Agent: Dondley Message-ID: <15168b1d0f01d2561fd2186eb80b2479@dondley.com> X-Sender: s@dondley.com Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Seq: 27115 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: > If you're never using these commands in any sort of pipeline or other > structured shell input, why are you using a general-purpose shell for > this at all? Why not write a taskwarrior front-end that does nothing > but read literal lines without interpretation and pass them along? This is how taskwarrior works out of the box, through the shell. Others have written front ends for TW: https://github.com/vit-project/vit But I'm 99% happy using TW through the command line especially since it allows me to write my own functions to speed up entering tasks with command arguments I use regularly. It wouldn't be a good idea to throw out the baby with the bath water and write my own front end or move to some front end that I may or may not be able to hack to behave as I wish to address this minor annoyance. > I think you'll find it's the shell that's removing (interpreting) the > quotes, not taskwarrior. Ok, yeah, didn't think about that. > But you aren't interacting with "an application" in the sense that you > mean it. You're interacting with the shell, which has explicit syntax > rules so that you can precisely describe what you intend to have it > do. I don't agree with this statement. If I launch a command with the shell and pass it some argument to open up a full-blown GUI for with a particular color theme, that doesn't mean I'm interacting with the shell. The shell is just a useful go-between and then it gets out of my way. Similarly, the shell is just a useful go-between for manipulating the TW database. I (usually) want it to get out of the way and leave me alone when I do that. I only want the shell to reveal itself at the appropriate times (like writing aliases and functions). But the more it can get out of the way when I'm trying to achieve my goal of manipulating the TW database, the better. For me to have to worry about making the shell happy when entering tasks is a nuisance I'd prefer not to deal with. > You're in effect arguing that this input should not be on a shell > command line and instead should always be consumed separately, so that > the shell doesn't have to interpret it first. No, I'm saying that I personally would like to get the best of both worlds, if possible. And why wouldn't I? And what could possibly be the harm in having the shell do some typing for me without me having to think about it? Isn't that what computers are for, to automate things for us? > If the only thing that ever follows "tasn" is something that's > supposed to be a human-readable sentence interpreted exactly as typed, > you can skip the whole business of messing about with checking for > quotes etc., but the fact that you're worried about autocompletion > suggests that is not the case. Correct, I can type in pro and it will autocomplete to "project:" for me. It can also autocomplete project names as and perform other minor completions (none of which will ever contain special characters that need to be escaped). > I'm going to assume that the trailing backquote there is a typo. > Here's a modification of PWS's widget, that really does take > everything after the word "tasn" (or any other word beginning with > "ta" or "tm") as raw human-readable text: > > taskwarrior-literal() { > setopt localoptions extendedglob > local -a match > # Assumes human never types tab or backslash > # and everything after the first word is literal > if [[ -z ${BUFFER/(#s)(#b)((ta|tm)[a-z](#c1,) )(*)/} && > $match[3] != *\\* ]] > then BUFFER="$match[1] ${(@q)${=match[3]}}" > fi > } > zle -N taskwarrior-literal > autoload add-zle-hook-widget > add-zle-hook-widget line-finish taskwarrior-literal Yeah, so I don't think this would work because I need for autocompletion. Or am I not understanding this?