1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-29 11:07:44 +00:00

feat: _ command for nushell for retrieving the last command

This commit is contained in:
RGBCube 2025-04-03 21:12:22 +03:00
parent e2c62cf970
commit 5d84c43a0c
Signed by: RGBCube
SSH key fingerprint: SHA256:CzqbPcfwt+GxFYNnFVCqoN5Itn4YFrshg1TrnACpA5M

View file

@ -158,9 +158,15 @@ $env.config.cursor_shape = {
$env.config.hooks = { $env.config.hooks = {
command_not_found: {||} command_not_found: {||}
display_output: "table --expand"
env_change: {} display_output: {
pre_execution: [ tee { table --expand | print }
| $env.last = $in
}
env_change: {}
pre_execution: [
{ {
let prompt = commandline | str trim let prompt = commandline | str trim
@ -171,7 +177,13 @@ $env.config.hooks = {
print $"(ansi title)($prompt) — nu(char bel)" print $"(ansi title)($prompt) — nu(char bel)"
} }
] ]
pre_prompt: []
pre_prompt: []
}
# Retrieve the output of the last command.
def _ []: nothing -> any {
$env.last
} }
$env.config.menus = [ $env.config.menus = [