dephell/dephell

`self autocomplete` doesn't respect ZDOTDIR env var when adding autocompletion for zsh

m-rey opened this issue · 0 comments

m-rey commented

Short description

When running dephell self autocomplete, dephell adds the necessary line for auto-completion in $HOME/.zshrc:

rc_path = Path.home() / '.zshrc'

However, the path to the directory where the rc file is in, can be set by the environment variable ZDOTDIR. Therefore, the dephell self autocomplete should check first if the environment variable ZDOTDIR is set and valid and use it to find .zshrc and add the necessary line for auto-completion. If it is invalid or simply not set, the default path to $HOME/.zshrc can be used.

Steps to reproduce

$ zsh
$ mkdir "$HOME/not_default_zsh_dir"
$ touch "$HOME/not_default_zsh_dir/.zshrc"
$ export ZDOTDIR="$HOME/not_default_zsh_dir"
$ dephell self autocomplete

dephell has added the source ... auto-completion line to $HOME/.zshrc instead of $ZDOTDIR/.zshrc

Versions

WARNING cannot find config file 
{
  "cache": "0b",
  "path": "/usr/lib/python3.8/site-packages/dephell",
  "python": "/usr/bin/python3",
  "version": "0.8.3",
  "versions": {
    "dephell-archive": "0.1.6",
    "dephell-argparse": "0.1.2",
    "dephell-changelogs": "0.0.1",
    "dephell-discover": "0.2.10",
    "dephell-licenses": "0.1.6",
    "dephell-links": "0.1.5",
    "dephell-markers": "1.0.3",
    "dephell-pythons": "0.1.14",
    "dephell-setuptools": "0.2.3",
    "dephell-shells": "0.1.4",
    "dephell-specifier": "0.2.1",
    "dephell-venvs": "0.1.17",
    "dephell-versioning": "0.1.1"
  }
}