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

Add "logout script" for interactive shell #12733

Open
Daudre-Vignier-Charles opened this issue May 2, 2024 · 1 comment
Open

Add "logout script" for interactive shell #12733

Daudre-Vignier-Charles opened this issue May 2, 2024 · 1 comment
Labels
enhancement New feature or request hooks Hooks are used to react to changes during interactive execution needs-design this feature requires design

Comments

@Daudre-Vignier-Charles
Copy link

Daudre-Vignier-Charles commented May 2, 2024

Related problem

In ZSH or Bash, I can execute scripts/commands when I close the interactive shell. In Bash and ZSH this functionnality is given by a script file, respectively ".bash_logout" and ".zlogout". Code inside this file is executed while the shell is closing. It seems that this functionnality doesnt exist in Nushell.

Describe the solution you'd like

Add any kind of functionality that allow code to be run while the shell exit.

Describe alternatives you've considered

No response

Additional context and details

Simple usage case :
While using the shell I use custom commands to populate in-memory database. I can initialise the database in the config.nu file for example but I cannot automaticaly save the database when exiting the shell.
This can be useful too for some cleaning like deleting temp files.

@Daudre-Vignier-Charles Daudre-Vignier-Charles added enhancement New feature or request needs-triage An issue that hasn't had any proper look labels May 2, 2024
@devyn
Copy link
Contributor

devyn commented May 2, 2024

I don't know if this is the right place for a hook, but maybe that's another option - just having an exit hook.

Have to watch out for exit() gotchas

@devyn devyn added needs-design this feature requires design hooks Hooks are used to react to changes during interactive execution and removed needs-triage An issue that hasn't had any proper look labels May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hooks Hooks are used to react to changes during interactive execution needs-design this feature requires design
Projects
None yet
Development

No branches or pull requests

2 participants