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

User-space location for completion files should be used, if system-wide locations are not accesible #10

Open
con-f-use opened this issue Nov 22, 2015 · 2 comments

Comments

@con-f-use
Copy link

Currently:

Creating completion files with docopt-completion fails, when the user doesn't have the appropriate permissions.

confus@confusion:~$ docopt-completion ./decorator.py
Skipping file /usr/share/zsh/functions/Completion/_decorator.py, no permissions
Skipping file /etc/bash_completion.d/decorator.py.sh, no permissions

Proposed:

The program should try to place completion files in the user space directories (e.g. $HOME/.bash_completion.d for bash), when the above permisson error is detected or implement a --user-space option to specify/auto-detect these directories.

@wiggin15
Copy link
Contributor

For zsh, the tool already looks for both user-specific and system-wide locations and tries to output to all available paths:

ZSH with oh-my-zsh: The path $HOME/.oh-my-zsh must exist.
ZSH with Prezto: The path $HOME/.zprezto must exist.
ZSH with no addons: The path /usr/share/zsh/*/functions must exist.
BASH with bash-completion: The path /etc/bash_completion.d must exist. 

For bash, I didn't know about $HOME/.bash_completion.d so the tool doesn't try that path. I'll add it. Thanks for the report.

In the meanwhile, you can run the tool with --manual-bash and it will generate the completion file in the local directory. Then, you can place it in the proper user-specific location that your system is configured to use.

@con-f-use
Copy link
Author

👍 Great thanks. I used --manual-bash

I seem to remember there was a config file in /ect/ or /usr/share/bash-completion/ specifying where in the users' directories to look for bash completion scripts. To look that up, would be the best solution. However, I can't find the specification for the live of me. What I can find, is that the file $HOME/.bash_completions is always sourced so appending there might be the slightly saver choice.

I think it's $HOME/.bash_completion.d/ in every but the most obscure Linux distributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants