Issue #243 closed
Daniele Faraglia
created an issue

Hi, i've a lot of problems with and oh-my-zsh, i can't use mkvirtualenv, mkproject and all commands that parse args like this line:

if i remove the condition dedicated to zsh, the bash one works.

➜  ~  zsh --version
zsh --version
zsh 5.0.2 (x86_64-pc-linux-gnu)
➜  ~  pip freeze | grep virtualenv

Comments (5)

  1. Doug Hellmann

    The tests pass under that version of zsh for me. Perhaps there is some other setting in your zshrc that causes argument parsing to be handled differently? I'm not that familiar with zsh, but usually when someone reports a problem it turns out to be something like that.

  2. Andrew Janke

    Yeah, zsh has some KSH_ARRAY* options that affect how array indexing works, and zero-indexing in particular. Setting those could break this option parsing.

    You can defend against it with emulate -L to locally restore portability-affecting options to known values within a function call. E.g. doing

    if [ -n "$ZSH_VERSION" ]
        emulate -L zsh

    will get you back to default zsh behavior (which you're testing under), or you could use emulate -L sh instead to get Bourne-like behavior. Could eliminate the need for some special cases, like this 0-vs-1-indexing thing. There are so many zsh options with significant effects that I've taken to doing this in most zsh functions intended for reuse.

  3. Log in to comment