denisidoro / navi

An interactive cheatsheet tool for the command-line
Apache License 2.0
15.22k stars 506 forks source link

Add executed command in shell history #909

Open yodamad opened 3 months ago

yodamad commented 3 months ago

Is your feature request related to a problem? Please describe.

When running a command from navi, this one is not stored into shell history. This behavior forces us to rerun navi if we want to re-run the command.

Describe the solution you'd like

Often, we need to re-run a command because it fails for instance. As navi doesn't store it into shell history, we cannot do the classic "up arrow" way to have it and re-run it easily.

It could be nice if commands run from navi can be stored into the history

Utopia

It can be even greater if we can have a flag on the command description to tell if the command has to be stored into the history or not. For instance, for sensitive commands, we may not want them to appear into the history

yanivmo commented 1 month ago

I run navi in zsh on Mac and it pastes the generated command in the command prompt. The command is executed as any other command, after hitting Enter, so it is in the history. I didn't change anything and got it out-of-the-box. Maybe it is a zsh thing?

There is also navi --print that probably could be used to achieve the same effect.