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

Update _completion_shared.py #728

Closed
wants to merge 1 commit into from

Conversation

bufferbit
Copy link

Wrap quotes around completion_path variable to solve potential issues from whitespace in the path name. I encountered this issue when using the --install-completion flag on a local module:

$ python3 -m cli --install-completion

This would create the file ~/.bash_completions/python3 -m cli.sh and broke code that referenced the unquoted path in .bashrc.


Something additional I thought of but could not figure out how to implement was adding the following code to .bashrc:

if [ -d "${HOME}/.bash_completions" ]; then
    for file in $(realpath -- "${HOME}/.bash_completions/*.sh"); do
        if [ -f "$file" ]; then
            source "$file"
        fi
    done
fi

This also solves the whitespace issue, but additionally removes the need to append a new line to .bashrc every time the --install-completion flag is used.

Wrap quotes around `completion_path` variable to solve potential issues from whitespace in the path name. Eg. "~/.bash_completions/file name.sh"
@svlandeg svlandeg added feature New feature, enhancement or request p3 and removed feature New feature, enhancement or request labels Feb 28, 2024
@svlandeg svlandeg self-assigned this Sep 4, 2024
Copy link
Member

@svlandeg svlandeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for the PR! Apologies for reviewing this so late - we've been going through our backlogs of PRs to catch up.

This fix has already been addressed by PR #801, so we'll go ahead and close this one. We really appreciate the effort though, so thanks again! 🙏

@svlandeg svlandeg closed this Sep 4, 2024
@svlandeg svlandeg removed their assignment Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature, enhancement or request p3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants