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")
}
}
I use xdg compliant bash history. Like this:
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: