zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Proof of concept mainstream plugin manager
Date: Wed, 27 Jan 2016 22:38:47 -0800	[thread overview]
Message-ID: <160127223847.ZM17546@torch.brasslantern.com> (raw)
In-Reply-To: <CAKc7PVB+wqm2t83obgqop3xAyXtiBSw+z_yVkhOZcFTvHzwxAQ@mail.gmail.com>

On Jan 27,  8:34am, Sebastian Gniazdowski wrote:
} Subject: Re: Proof of concept mainstream plugin manager
}
} > Sebastian has already changed that whole thing to be
} >
} > functions[$func]="_reload_and_run ${(q)PLUGIN_DIR} $opts $func "'"$@"
} 
} I commited your eval way to recognize it in battle (Polish idiom,
} wonder if it works in English). Without quoting in ${(qq)opts}, what
} you recommended earlier, I get list of all defined functions

Oh.  Yes, you need to pass empty string there if there are no options,
because _reload_and_run interprets its first 3 arguments positionally
and all are required to be present.  Sorry about that.

So if you want to use the assignment form, you need

functions[$func]="_reload_and_run ${(q)PLUGIN_DIR} ${${(q)opts[@]}} $func "'"$@"'

The ${(qq)opts[@]} quotes every element separately, and then the outer
${...} compbines the result into a single string again.

} > which yes, is going to do strange things if $func contains spaces.
} >
} > On the other hand, the whole plugin would already be broken if $func
} > contains spaces.  I'd rather not "fix" it in an unpredictable way.
} 
} What do you mean? Shouldn't I do quoting, i.e. ${(q)func} ?

Whether you want the (q) is entirely up to you.  The result will be
broken if there are any spaces in $func whether you (q) or not,
because functions[$func]=... will already have created something
that can't be run.

Back on the first hand, I suppose if $func somehow contains a semicolon
or some globbing characters, rather than just spaces, then you should
quote those.  So yes, ${(q)func} is better.


  reply	other threads:[~2016-01-28  6:38 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-22 19:44 Sebastian Gniazdowski
2016-01-23  1:37 ` Bart Schaefer
2016-01-23  9:03   ` Sebastian Gniazdowski
2016-01-23 15:54     ` Sebastian Gniazdowski
2016-01-23 16:00       ` Sebastian Gniazdowski
2016-01-23 16:09         ` Sebastian Gniazdowski
2016-01-23 16:26           ` Sebastian Gniazdowski
2016-01-23 17:36           ` Bart Schaefer
2016-01-23 19:20             ` Bart Schaefer
2016-01-23 20:00               ` Bart Schaefer
2016-01-24 10:51                 ` Sebastian Gniazdowski
2016-01-24 14:59                   ` Sebastian Gniazdowski
2016-01-24 19:06                     ` Sebastian Gniazdowski
2016-01-24 20:45                     ` Bart Schaefer
2016-06-04 11:36                       ` Sebastian Gniazdowski
2016-06-04 17:02                         ` Bart Schaefer
2016-01-26 22:50                   ` Daniel Shahaf
2016-01-27  7:47                     ` Sebastian Gniazdowski
2016-01-26 22:50                 ` Daniel Shahaf
2016-01-27  4:34                   ` Bart Schaefer
2016-01-27  7:34                     ` Sebastian Gniazdowski
2016-01-28  6:38                       ` Bart Schaefer [this message]
2016-01-28  7:13                         ` Sebastian Gniazdowski

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=160127223847.ZM17546@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@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).