-
-
Notifications
You must be signed in to change notification settings - Fork 508
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
Incognito mode #517
Comments
and sets |
I think I would like to see existing history, but that could be a further flag I guess |
There needs to be something to add the ability to either pause logging or stop displaying history for things like sudo. May be an option to just filter out items containing configurable keywords such as ‘sudo’ or ‘supercooladmintool’. However, I think people will want to pause the logging temperately. |
I use the following function to toggle atuin history saving. Then I can use my terminal without the commands getting persisted in the database. Searching will still work in incognito mode. Usage: ZSH: incognito () {
if [[ $1 = disable ]] || [[ $1 == d ]]
then
add-zsh-hook precmd _atuin_precmd
add-zsh-hook preexec _atuin_preexec
else
add-zsh-hook -d precmd _atuin_precmd
add-zsh-hook -d preexec _atuin_preexec
fi
} If I want those commands to also not be saved in the shell history file, I also enter Bash: incognito () {
if [[ $1 = disable ]] || [[ $1 == d ]]
then
# disable incognito
if [[ -n "${BLE_VERSION-}" ]]; then
echo "no idea what ble is (no incognito mode available here)"
else
precmd_functions+=(_atuin_precmd)
preexec_functions+=(_atuin_preexec)
fi
else
# enable incognito
if [[ -n "${BLE_VERSION-}" ]]; then
echo "no idea what ble is (no incognito mode available here)"
else
precmd_functions=("${precmd_functions[@]/_atuin_precmd}")
preexec_functions=("${preexec_functions[@]/_atuin_preexec}")
fi
fi
} For fish, it would be this (I'm no fish user, so this could be a bit janky), though you would have to modify the functions, when they change in the future: function incognito
if [ "$argv[1]" = d -o "$argv[1]" = disable ]
# disable incognito and re-set the functions to the atuin functions
function _atuin_preexec --on-event fish_preexec
set -gx ATUIN_HISTORY_ID (atuin history start -- "$argv[1]")
end
function _atuin_postexec --on-event fish_postexec
set s $status
if test -n "$ATUIN_HISTORY_ID"
RUST_LOG=error atuin history end --exit $s -- $ATUIN_HISTORY_ID &>/dev/null &
disown
end
end
else
# enable incognito and empty the atuin functions
function _atuin_preexec --on-event fish_preexec
:
end
function _atuin_postexec --on-event fish_postexec
:
end
end
end
|
As I mentionned in #467 in bash you can prevent commands from entering history when you precede them with a space. |
This works with atuin too |
what about instead of spawning a new shell, you first create a copy of the db w/ the |
I think it would be cool if we could do
And spawn a subshell. In this subshell we will have syncing disabled, and we will be working with a local copy of our normal history database.
When you exit the subshell, the database is 'rolled back'. As if the commands were never run.
There could be a
atuin incognito commit
if you decide you want to keep the commands.Scenario: you are playing around with a REST API in curl and need to use an auth token, but don't want to set up environment variables and don't want the token in your shell history
The text was updated successfully, but these errors were encountered: