Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocompletion does not work with relative paths anymore #1796

Closed
cactushydrocodone opened this issue Dec 30, 2021 · 5 comments · Fixed by #1805
Closed

Autocompletion does not work with relative paths anymore #1796

cactushydrocodone opened this issue Dec 30, 2021 · 5 comments · Fixed by #1805
Labels
bug Something isn't working

Comments

@cactushydrocodone
Copy link

cactushydrocodone commented Dec 30, 2021

Describe the bug

Autocompletion does not do relative paths.

To reproduce

  1. Go into your home directory (/home/mark)
  2. Type in chezmoi edit .config
  3. Chezmoi will not autocomplete

Expected behavior

Chezmoi should be able to autocomplete relative paths

Output of command with the --verbose flag

There is no output as the autocomplete does not generate one.

Output of chezmoi doctor

RESULT    CHECK                MESSAGE
warning   version              v2.9.4, built at 2021-12-28T14:33:29Z
ok        os-arch              linux/amd64 (Arch Linux)
ok        go-version           go1.17.5 (gc)
ok        executable           /usr/bin/chezmoi
ok        config-file          ~/.config/chezmoi/chezmoi.toml
ok        source-dir           ~/.local/share/chezmoi is a directory
ok        suspicious-entries   no suspicious entries
ok        working-tree         ~/.local/share/chezmoi is a directory
ok        dest-dir             ~ is a directory
ok        shell                found /bin/bash
ok        edit-command         found /usr/bin/nvim
ok        umask                022
ok        git-command          found /usr/bin/git, version 2.34.1
ok        merge-command        found /usr/bin/vimdiff
info      age-command          age not found in $PATH
ok        gpg-command          found /usr/bin/gpg, version 2.2.32
info      pinentry-command     not set
info      1password-command    op not found in $PATH
ok        bitwarden-command    found /usr/bin/bw, version 1.20.0
info      gopass-command       gopass not found in $PATH
info      keepassxc-command    keepassxc-cli not found in $PATH
info      keepassxc-db         not set
info      lastpass-command     lpass not found in $PATH
info      pass-command         pass not found in $PATH
info      vault-command        vault not found in $PATH
info      secret-command       not set

Additional context

If you do chezmoi editand hit tab twice, it shows the absolute path of the home directory (like /home/mark) and after that, autocompletion works.

If you enter the relative path manually after chezmoi edit like chezmoi edit .config/i3/config it opens the file without issue.

@cactushydrocodone
Copy link
Author

cactushydrocodone commented Dec 30, 2021

I downgraded the chezmoi package and the issue does not appear until chezmoi 2.9.3-1

@twpayne twpayne added the bug Something isn't working label Jan 3, 2022
@twpayne
Copy link
Owner

twpayne commented Jan 3, 2022

Thanks for reporting this. This is a definite bug in chezmoi, most likely introduced by #1736.

@twpayne twpayne added investigating This is a bit weird, not sure if this is a bug yet and removed bug Something isn't working labels Jan 5, 2022
@twpayne twpayne added bug Something isn't working and removed investigating This is a bit weird, not sure if this is a bug yet labels Jan 5, 2022
@Mrfiregem
Copy link

Mrfiregem commented Jan 9, 2022

Completion still fails when using paths that start with ~ or a variable (e.g. ~/.config/foo or $XDG_CONFIG_HOME/foo), which both worked when using default fish completion. Also, it would be extremely helpful if completion added trailing / to enable the use of successive tab completions for files in subdirectories.

Edit: Version 2.9.5 and using chezmoi completion fish > ~/.config/fish/completion/chezmoi.fish.

@twpayne
Copy link
Owner

twpayne commented Jan 9, 2022

Completion still fails when using paths that start with ~ or a variable (e.g. ~/.config/foo or $XDG_CONFIG_HOME/foo), which both worked when using default fish completion

This is due to a bug in cobra's fish completions. I've opened spf13/cobra#1577 to report it.

@cactushydrocodone
Copy link
Author

cactushydrocodone commented Jan 14, 2022

The latter part about the trailing slash also affects bash.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants