Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: suffix alias where the app has a space in it



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



Messages sorted by: Reverse Date, Date, Thread, Author