atuin icon indicating copy to clipboard operation
atuin copied to clipboard

Don't regenerate config file unless asked

Open iwahbe opened this issue 1 year ago • 2 comments

Whenever atuin is run, even when it is run to save a new command (on every command), it regenerates the config file:

https://github.com/atuinsh/atuin/blob/72c6b17ac7ed0916df81eddae6aecfe97e4f0917/atuin-client/src/settings.rs#L400

I noticed this when I was trying to simlink the $HOME/config/atuin/config.toml and even after I deleted the file, it already existed. To symlink, I needed to run rm -r ~/.config/atuin && ln -s -w $PWD/home/.config/atuin home/.config/atuin, since rm -r ~/.config/atuin and then ln -s -w $PWD/home/.config/atuin home/.config/atuin will fail to link.

It would be nice if there was a CLI flag on atuin init to disable this behavior.

iwahbe avatar Aug 17 '23 12:08 iwahbe

Small clarification: it regenerates the config file if it doesn't already exist; the file isn't recreated in-place on every execution.

There is ln -f that will take care of this for your use case.

I had forgotten, but I hit this too with my config being built by home-manager, which does something similar, and fails if the generated config it's trying to deploy conflicts with an existing file. The workaround was easy enough that I don't remember exactly what I did; probably just started a plain /bin/sh without atuin?

The only real practical impact is that if defaults change, existing users will keep the old defaults in the file previously written.

dcarosone avatar Sep 29 '23 02:09 dcarosone

It's super easy to work around the creation. The hard part for me was discovering that the file being created.

iwahbe avatar Sep 29 '23 16:09 iwahbe