Skip to content

shell history is not xdg compliant. #1

Description

@vaznerd

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")
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions