WIP: Added support for calling arbitrary script with .env variables provided - #105
Conversation
4 similar comments
|
Thanks, for making this feature move. As for the integration, I would prefer to merge this to existing cli. This could be yet another command for running commands. As for the API, it make sense to have it as: This way it doesn't try to overwrite/conflict any existing commands. This format is also consistent with |
|
Sure, if click can deal with something like $ dotenv run ls -lah -f <path-to-dotenv>or $ dotenv run git status -f <path-to-dotenv>and is able to associate all options an params to the Also, feel free to update this branch according to your suggestion if you like. |
|
This is a valid point and I'll also have to look into it. Thinking out loud, I think the solution around confusing API could be allowing |
|
This should do the trick. It works with: |
|
Ok I think I'm done. I won't start a fight with coveralls, I believe I've covered all relevant cases. Please review. |
|
Looks awesoome!! 💟 |
…theskumar#105) * Added support for calling arbitrary script with .env variables provides * Integrated everything into cli.py * Fail properly when no command given and exit with return code of command * Updated README * Added tests. * Fixed test for run w/o command
Hi,
I've started working on a feature that'll allow to use the CLI like this:
which will parse the
.envfile and callsfooin a subprocess with the environment variables from.envmerged with the ones fromos.environ. This is similar to the behavior of ruby-dotenv.For now everything is in
dotenv/__main__so you could easily add anotherconsole_scriptinsetup.py. I've stopped here as I think it would probably better to merge it in the existingdotenvscript, however I think the default action should be as described above, and the existing options from thedotenvscript should be optional. Please let me know what you think and if and how to proceed.