zsh-users
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane.chazelas@gmail.com>
To: TJ Luoma <luomat@gmail.com>
Cc: Zsh MailingList <zsh-users@zsh.org>
Subject: Re: suffix alias where the app has a space in it
Date: Thu, 8 Aug 2019 12:50:26 +0100	[thread overview]
Message-ID: <20190808115026.ctryk6bsvckxj7cq@chaz.gmail.com> (raw)
In-Reply-To: <CADjGqHv7H6xsYHYwNwD49LEQsHWw4DdzBtpFK=C=umLGDNdZEQ@mail.gmail.com>

2019-08-08 07:14:21 -0400, TJ Luoma:
> I'm trying to use suffix aliases, but I ran into one issue I can't
> figure out: What do I do when I want to assign "The Unarchiver" as an
> app for archives such as .xz
> 
> alias -s  xz="the unarchiver"
> 
> But that tries to use 'the' to open 'xz' files.
> 
> Is there a way to encode a space in the app name?
> 
> I tried googling but either the terms are too vague or no one has
> written about this before.
[...]

alias replacement is token replacement before parsing of the
syntax. That applies to suffix aliases as well. You can even do
something as crazy as:

alias -s xz='for cmd (echo "the unarchiver") $cmd'

And when you enter:

foo.xz

that gets replaced with 

for cmd (echo "the unarchiver") $cmd foo.xz

In your case, just do:

alias -s "xz='the unarchiver'"

-- 
Stephane

      parent reply	other threads:[~2019-08-08 11:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190808111626epcas1p28034457322a4f06a363aed6763a5b859@epcas1p2.samsung.com>
2019-08-08 11:14 ` TJ Luoma
2019-08-08 11:47   ` Peter Stephenson
2019-08-08 12:09     ` TJ Luoma
2019-08-08 17:40       ` TJ Luoma
2019-08-08 21:30         ` Bart Schaefer
2019-08-08 11:50   ` Stephane Chazelas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190808115026.ctryk6bsvckxj7cq@chaz.gmail.com \
    --to=stephane.chazelas@gmail.com \
    --cc=luomat@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).