influxdb-cli does not follow xdg base directory specification

Open Beginner friendly
#514 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
go
Domain
cli

Research direction

Start in clients/v1_shell/v1_shell.go around line 153, where the CLI history path is handled. Check the XDG_STATE_HOME fallback behavior and confirm that history is saved under $XDG_STATE_HOME/influx/history or $HOME/.local/state/influx/history when the variable is unset, instead of $HOME/influx_history.

Written by the indexing model from the issue text.

Description

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

Dominant language
Go
Stars
75
Forks
22
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from influxdata/influx-cli

All issues in influxdata/influx-cli

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.