miklos-martin / oh-my-zsh-plugins

This repo contains some useful plugins for oh-my-zsh.
MIT License
14 stars 7 forks source link

Fix plugins to work on OS X as well #3

Open miklos-martin opened 11 years ago

miklos-martin commented 11 years ago

Detect flaws and fix them on OS X. For example, the -eq condition is not working. The pool_port stuff in nginx and php-fpm plugins doesn't work either, because it is calculated from the current user's id, which is extracted from /etc/passwd. It's not the same on OS X.

miklos-martin commented 11 years ago

2 will fix the pool_port thing.

patkujawa-wf commented 10 years ago

EDIT: I'm not sure why the no-color stuff is printed when the command doesn't match, but https://github.com/miklos-martin/oh-my-zsh-plugins/issues/13 fixes the issue for me :). I'm on OS X and having some issues, so I guess it makes sense to list them here.

If I do bower link <TAB> I get: bower link _bower:67: command not found: --no-color[Do not print colors (available in all commands)] _bower:67: command not found: --no-color[Do not print colors (available in all commands)] _bower:67: command not found: --no-color[Do not print colors (available in all commands)]

That's odd, because I see 'link' in the list of commands:

❯ which _bower                                                                                                                                                                  ⏎
_bower () {
    local -a _1st_arguments _no_color _dopts _save_dev _force_lastest _production
    local expl
    typeset -A opt_args
    _no_color=('--no-color[Do not print colors (available in all commands)]')
    _dopts=('(--save)--save[Save installed packages into the project"s bower.json dependencies]' '(--force)--force[Force fetching remote resources even if a local copy exists on disk]')
    _save_dev=('(--save-dev)--save-dev[Save installed packages into the project"s bower.json devDependencies]')
    _force_lastest=('(--force-latest)--force-latest[Force latest version on conflict]')
    _production=('(--production)--production[Do not install project devDependencies]')
    _1st_arguments=('cache-clean:Clean the Bower cache, or the specified package caches' 'help:Display help information about Bower' 'info:Version info and description of a particular package' 'init:Interactively create a bower.json file' 'install:Install a package locally' 'link:Symlink a package folder' 'lookup:Look up a package URL by name' 'register:Register a package' 'search:Search for a package by name' 'uninstall:Remove a package' 'update:Update a package' {ls,list}:'[List all installed packages]')
    _arguments $_no_color '*:: :->subcmds' && return 0
    if (( CURRENT == 1 ))
    then
        _describe -t commands "bower subcommand" _1st_arguments
        return
    fi
    case "$words[1]" in
        (install) _arguments $_dopts $_save_dev $_force_lastest $_no_color $_production ;;
        (update) _arguments $_dopts $_no_color $_force_lastest
            _bower_installed_packages
            compadd "$@" $(echo $bower_package_list) ;;
        (uninstall) _arguments $_no_color $_dopts
            _bower_installed_packages
            compadd "$@" $(echo $bower_package_list) ;;
        (*) $_no_color ;;
    esac
}
miklos-martin commented 10 years ago

@patkujawa-wf please note, that this code is introduced in robbyrussell/oh-my-zsh#1919 and I have nothing to do with that. But I obviously need to do a review on my version of the bower plugin. It's a bit out of date now :)

patkujawa-wf commented 10 years ago

Ah, I see. Thanks for the link!

miklos-martin commented 10 years ago

BTW, try to make the last case look like this:

*) _arguments $_no_color ;;