{"action":"opened","issue":{"url":"https://api.github.com/repos/horosgrisa/autoenv/issues/3","labels_url":"https://api.github.com/repos/horosgrisa/autoenv/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/horosgrisa/autoenv/issues/3/comments","events_url":"https://api.github.com/repos/horosgrisa/autoenv/issues/3/events","html_url":"https://github.com/horosgrisa/autoenv/issues/3","id":120625215,"number":3,"title":"$1 is passed to .env files","user":{"login":"Nagasaki45","id":2564187,"avatar_url":"https://avatars.githubusercontent.com/u/2564187?v=3","gravatar_id":"","url":"https://api.github.com/users/Nagasaki45","html_url":"https://github.com/Nagasaki45","followers_url":"https://api.github.com/users/Nagasaki45/followers","following_url":"https://api.github.com/users/Nagasaki45/following{/other_user}","gists_url":"https://api.github.com/users/Nagasaki45/gists{/gist_id}","starred_url":"https://api.github.com/users/Nagasaki45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nagasaki45/subscriptions","organizations_url":"https://api.github.com/users/Nagasaki45/orgs","repos_url":"https://api.github.com/users/Nagasaki45/repos","events_url":"https://api.github.com/users/Nagasaki45/events{/privacy}","received_events_url":"https://api.github.com/users/Nagasaki45/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-06T10:43:23Z","updated_at":"2015-12-06T10:43:23Z","closed_at":null,"body":"Bash function arguments are passed to the sourced .env and .out scripts. For example:\r\n\r\n    ➜  ~  ls -a test_autoenv\r\n    .  ..  .env\r\n    ➜  ~  cat test_autoenv/.env \r\n    echo \"$1\"\r\n    ➜  ~  cd test_autoenv \r\n    /home/nagasaki45/test_autoenv/.env\r\n    ➜  test_autoenv  \r\n\r\nMore info about this behavior can be found [here](http://stackoverflow.com/questions/17361966/source-a-file-within-a-function-takes-function-parameters)\r\n\r\nSpecifically, it breaks [activation and deactivation](http://conda.pydata.org/docs/using/envs.html#change-environments-activate-deactivate) of conda environments. For example, I have a conda environment named ``conda_autoenv``, which usually activated and deactivated using ``source activate conda_autoenv`` and ``source deactivate``. Here is the bug:\r\n\r\n    ➜  ~  ls -a test_autoenv \r\n    .  ..  .env  .out\r\n    ➜  ~  cat test_autoenv/.env \r\n    source activate conda_autoenv\r\n    ➜  ~  cat test_autoenv/.out \r\n    source deactivate\r\n    ➜  ~  cd test_autoenv \r\n    discarding /home/nagasaki45/miniconda3/bin from PATH\r\n    prepending /home/nagasaki45/miniconda3/envs/conda_autoenv/bin to PATH\r\n    Error: too many arguments.\r\n    (conda_autoenv)➜  test_autoenv  cd ..\r\n    Error: too many arguments.\r\n    (conda_autoenv)➜  ~ \r\n\r\nNotice environment **was** activated, after all. However, the deactivation failed.\r\n\r\nA possible solution I found, based on [this answer in stackoverflow](http://stackoverflow.com/a/17362498/1224456), can be found at https://github.com/Nagasaki45/autoenv/tree/better_source. With the proposed solution:\r\n\r\n    ➜  ~  cd test_autoenv\r\n    discarding /home/nagasaki45/miniconda3/bin from PATH\r\n    prepending /home/nagasaki45/miniconda3/envs/conda_autoenv/bin to PATH\r\n    discarding /home/nagasaki45/miniconda3/envs/conda_autoenv/bin from PATH\r\n    (conda_autoenv)➜  test_autoenv  which python\r\n    /home/nagasaki45/miniconda3/envs/conda_autoenv/bin/python\r\n    (conda_autoenv)➜  test_autoenv  cd ..\r\n    discarding /home/nagasaki45/miniconda3/envs/conda_autoenv/bin from PATH\r\n    ➜  ~\r\n\r\nThere are still issues with this solution, which I'm unable to understand. See the 3rd line after cd to the test_autoenv directory - it looks like the environment is not working as expected. On the other hand working in that envirnment is fine, everything works as expected."}}