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

Comments

Projects
None yet
3 participants
@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

This comment has been minimized.

Show comment
Hide comment
@zanchey

zanchey Jul 14, 2014

Member

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
Member

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

This comment has been minimized.

Show comment
Hide comment
@zanchey

zanchey Jul 14, 2014

Member

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

Member

zanchey commented Jul 14, 2014

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

@critias

This comment has been minimized.

Show comment
Hide comment
@critias

critias 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 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 referenced this issue Sep 6, 2014

Closed

Preexec event #1666

@kballard kballard closed this in 646d9ab Oct 2, 2014

@kballard kballard added this to the next-minor milestone Oct 2, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment