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

feat: Add option to turn off setup of shell completion #342

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mmcrockett
Copy link
Contributor

Issue

  • When I moved from Linux => Mac I didn't have bash completion package installed and so got these errors (plus turns out I really prefer to complete on filenames even though the branch complete is a nice feature)

Screenshot of errors I see:
Screenshot 2024-12-11 at 1 32 14 PM

Proposed Fix

  • Add an option git_skip_shell_completion that is backward compatible and will ignore any shell completion setup

@mmcrockett mmcrockett changed the title mcrockett/Add option to turn off setup of shell completion Add option to turn off setup of shell completion Dec 11, 2024
@mmcrockett mmcrockett changed the title Add option to turn off setup of shell completion feat: Add option to turn off setup of shell completion Dec 11, 2024
Comment on lines +50 to +65
if [ "$git_skip_shell_completion" != "yes" ]; then
__define_git_completion () {
eval "
_git_$1_shortcut () {
COMP_LINE=\"git $2 \${COMP_LINE/$1 }\"
let COMP_POINT+=$((4+${#2}-${#1}))
COMP_WORDS=(git $2 \"\${COMP_WORDS[@]:1}\")
let COMP_CWORD+=1

local cur words cword prev
_get_comp_words_by_ref -n =: cur words cword prev
__git_wrap__git_main
}
"
}
fi
Copy link
Member

Choose a reason for hiding this comment

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

Because this is already an eval hidden behind a function definition, I would prefer not placing this in an if condition. The calling of this function is already behind the new setting that you added.

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

Successfully merging this pull request may close these issues.

2 participants