devgrep icon indicating copy to clipboard operation
devgrep copied to clipboard

shell history is not xdg compliant.

Open vaznerd opened this issue 5 months ago • 1 comments

I use xdg compliant bash history. Like this:

export XDG_STATE_HOME="$HOME/.local/state"
export HISTFILE="$XDG_STATE_HOME/bash/history"

But this project only sees .bash_history. How about using HISTFILE to check for the file and then fallback to .bash_history. both bash and zsh uses HISTFILE and it contains .bash_history anyways if unset.

A simple code would be like this:

historyPath := os.Getenv("HISTFILE")
if historyPath == "" {
	shell := os.Getenv("SHELL")
	switch shell {
	case "bash":
		historyPath = filepath.Join(home, ".bash_history")
	case "zsh":
		historyPath = filepath.Join(home, ".zsh_history")
	}
}

vaznerd avatar Jun 23 '26 13:06 vaznerd

Hi there! Thanks for bringing this up. You're absolutely right that we should respect HISTFILE for better XDG compliance.

I've opened a pull request to address this: https://github.com/aasixh/devgrep/pull/2

The update checks the HISTFILE environment variable first and falls back to the standard .bash_history or .zsh_history paths if it's not set.

Let me know if you have any thoughts! Thanks again.

webbrain-one avatar Jul 30 '26 08:07 webbrain-one