Hi

As I recall that script requires a POSIX shell (which fish is not). I use this very crude version of the virtualenvwrapper workon command

function workon

    switch (count $argv)

        case 0

        cd $WORKON_HOME

        ls -d1 */ |         xargs basename

        cd -

        case 1

        if count $CURRENT_VIRTUALENV

            echo virtualenv already invoked $CURRENT_VIRTUALENV

            echo deactivate before involing new virtualenv

            return

        end

        cd $WORKON_HOME

        set envs (ls -d1 */ | xargs basename)

        cd -

        set found 0

        for i in $envs

            if test $argv[1] = $i

                set PATH $WORKON_HOME/$i/bin $PATH

                set -g CURRENT_VIRTUALENV \($i\)

                set found 1

            end

        end

        if test $found = 0

            echo ERROR: environment not found \($argv[1]\)

        end

    end

end


And here's my prompt that includes current virtualenv.

function fish_prompt

    printf '%...@%s%s[%s]%s$ ' "$CURRENT_VIRTUALENV" (whoami) (hostname|cut -d 
. -f 1) (set_color $fish_color_cwd) (pwd) (set_color normal)


And deactivate

function deactivate

    if count $CURRENT_VIRTUALENV

        set -e PATH[1]

        set -e CURRENT_VIRTUALENV

    else

        echo ERROR: virtualenv not invoked, exiting

    end

end





On 10/10/2010 01:06, Italo Maia wrote:
I asked that because i'm having trouble activating python virtualenv environments. I tried using dot like:

. virtualenv/env/bin/activate

And it did not work. ps: mentioning that "source" is "." in docs or faq would be extremelly helpful.

2010/10/9 Philip Ganchev <[email protected] <mailto:[email protected]>>

    The command is ".' (dot)

    http://fishshell.org/user_doc/commands.html#source

    It does not do both "." and
    "source" because Fish is intended
    to have
    a small set of features that do
    different things (the Law of
    Orthogonality:
    http://fishshell.org/user_doc/design.html
    )

    But maybe the documentation for
    the command should actually mention
    the word "source". Maybe it should
    be in the FAQ?


    On Fri, Oct 8, 2010 at 5:47 PM,
    Italo Maia <[email protected]
    <mailto:[email protected]>> wrote:
    > Why the `source` command does
    not work with fish?




--
"A arrogância é a arma dos fracos."

===========================
Italo Moreira Campelo Maia
Graduado em Ciência da Computação - UECE
Desenvolvedor WEB e Desktop (Java, Python, Lua)
Coordenador do Pug-CE
-----------------------------------------------------
http://www.italomaia.com/
http://twitter.com/italomaia/
http://eusouolobomau.blogspot.com/
-----------------------------------------------------
turtle linux 910 - http://tiny.cc/blogturtle910
===========================


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2&  L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb


_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to