Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run a function before executing the actual command #1549

Closed
critias opened this issue Jul 13, 2014 · 3 comments
Closed

Run a function before executing the actual command #1549

critias opened this issue Jul 13, 2014 · 3 comments
Labels
Milestone

Comments

@critias
Copy link

@critias critias commented Jul 13, 2014

I couldn't find a way to run a function before every executed command.
This function would be useful in my case to create a local history which saves all commands executed in a directory to a file in this directory before executing the command.
It would also allow to automatically stop how much time each command needed to execute.

@zanchey
Copy link
Member

@zanchey zanchey commented Jul 14, 2014

The current suggestion is to hook on the _ variable change, although that runs before and after every command.

~> function blah --on-variable _
                       echo _ is $_
   end
~> whoami
_ is whoami
zanchey
_ is fish
@zanchey zanchey added the enhancement label Jul 14, 2014
@zanchey
Copy link
Member

@zanchey zanchey commented Jul 14, 2014

See also #477, which expands the ideas above beyond simply 'preexec'.

@critias
Copy link
Author

@critias critias commented Jul 15, 2014

Thanks, but that would not solve my problem (if I understand it correct). I need the whole command line as parameter and only once.
Here is the main discussion about this issue: #1550

critias pushed a commit to critias/fish-shell that referenced this issue Jul 16, 2014
critias pushed a commit to critias/fish-shell that referenced this issue Jul 16, 2014
critias pushed a commit to critias/fish-shell that referenced this issue Sep 6, 2014
@critias critias mentioned this issue Sep 6, 2014
@lilyball lilyball closed this in 646d9ab Oct 2, 2014
@lilyball lilyball added this to the next-minor milestone Oct 2, 2014
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.