You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the pre_execution hook in Nushell runs before a command executes but does not receive any details about the command itself. This feature request proposes passing a record containing the command's details (e.g., the full command line) to the hook block, allowing for more advanced pre-execution logic.
Motivation
Currently, the pre_execution hook does not receive any command details, limiting its usefulness for debugging, logging, and command analysis. Many tools in other shells, such as alias-finder in Zsh, rely on access to the command being executed. Adding this feature would enable similar functionality in Nushell, allowing users to build plugins for alias discovery, shell logging, and execution monitoring.
Describe the solution you'd like
Proposed Behavior
If the hook block is defined without parameters, it behaves as it does today.
If the block expects a parameter, Nushell passes a record containing details about the command being executed.
At a minimum, the record should include the full command string before execution.
Usage Example
With this feature, users could define a pre_execution hook like this:
Related problem
Currently, the
pre_execution
hook in Nushell runs before a command executes but does not receive any details about the command itself. This feature request proposes passing a record containing the command's details (e.g., the full command line) to the hook block, allowing for more advanced pre-execution logic.Motivation
Currently, the
pre_execution
hook does not receive any command details, limiting its usefulness for debugging, logging, and command analysis. Many tools in other shells, such asalias-finder
in Zsh, rely on access to the command being executed. Adding this feature would enable similar functionality in Nushell, allowing users to build plugins for alias discovery, shell logging, and execution monitoring.Describe the solution you'd like
Proposed Behavior
Usage Example
With this feature, users could define a
pre_execution
hook like this:The text was updated successfully, but these errors were encountered: