shell history is not xdg compliant.
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")
}
}
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.