Open ipwnponies opened 6 years ago
Are there any workarounds? Trying to see if there's some hacky way of using aactivator from fish until/if this feature is implemented.
to implement this:
source
is (unfortunately, I don't think this is possible to do for the current integration which assumes at least .sh
compatibility)@asottile You're right about posix shell compatibility, where I hit a wall in trying to add fish support. aactivator
uses a template string and some syntax will not work for fish. But rather than swap to a different template string, I feel there are enough fish-isms that can better work here for maintainability and compatibility (alluded to with "expose sub-commands like security-check
). Rather than constrain to the interface of "something that can be source
".
Pre and post command is handled by registering onto events. Docs:
fish_preexec, which is emitted right before executing an interactive command. The commandline is passed as the first parameter. Not emitted if command is empty.
fish_postexec, which is emitted right after executing an interactive command. The commandline is passed as the first parameter. Not emitted if command is empty.
function aactivate --on-event fish_preexec
source venv/bin/activate.fish
end
You can call source
on a file or you can pipe stdin to source
.
aactivator.py --fish | source
It would be nice to add support for fish shell users. This would require targeting a different virtualenv activation script (activate.fish) and using fish syntax for the output eval command.
If fully supporting fish is too much scope, then maybe we can expose additional sub-commands (like
security-check
) that will enable fish users to implement remainder of the logic.If you're receptive to this idea, I can investigate further once we decide on general direction.