influxdata / influx-cli

CLI for managing resources in InfluxDB v2
MIT License
65 stars 24 forks source link

influxdb-cli does not follow xdg base directory specification #514

Open pavelskipenes opened 1 year ago

pavelskipenes commented 1 year ago

TLDR; save history to $HOME/.local/state/influx/history if $XDG_STATE_HOME is not defined otherwise to $XDG_STATE_HOME/influx/history instead of $HOME/influx_history.

From XDG Base Directory Specification:

The XDG Base Directory Specification is based on the following concepts:

  • There is a single base directory relative to which user-specific state data should be written. This directory is defined by the environment variable $XDG_STATE_HOME.

    The $XDG_STATE_HOME contains state data that should persist between (application) restarts, but that is not important or portable enough to the user that it should be stored in $XDG_DATA_HOME. It may contain:

  • actions history (logs, history, recently used files, …)

Looks like relevant lines are around here: https://github.com/influxdata/influx-cli/blob/3a2e139292fcb3f854ebfbf40f0cf2de90b1b511/clients/v1_shell/v1_shell.go#L153