Skip to content

docs: update completion guide #5239

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

Merged
merged 4 commits into from
Dec 19, 2024

Conversation

alexandear
Copy link
Member

@alexandear alexandear commented Dec 18, 2024

This PR updates "Shell Completion" guide.

@alexandear alexandear added area: docs enhancement New feature or improvement labels Dec 18, 2024
@ldez
Copy link
Member

ldez commented Dec 18, 2024

The current sentences are a note about a limitation with Bash, this is not Bash section, we will not describe each completion possibility (and only on macOS) it makes no sense.

@ldez ldez closed this Dec 18, 2024
@ldez ldez added declined and removed enhancement New feature or improvement area: docs labels Dec 18, 2024
@alexandear
Copy link
Member Author

So, maybe we can delete Linux section also? And leave only:


Shell Completion

golangci-lint can generate Bash, fish, PowerShell, and Zsh completion files.

See the instructions on golangci-lint completion <YOUR_SHELL> --help (replace <YOUR_SHELL> with your favorite one).

macOS

There are two versions of bash-completion, v1 and v2. V1 is for Bash 3.2 (which is the default on macOS), and v2 is for Bash 4.1+. The golangci-lint completion script doesn’t work correctly with bash-completion v1 and Bash 3.2. It requires bash-completion v2 and Bash 4.1+. Thus, to be able to correctly use golangci-lint completion on macOS, you have to install and use Bash 4.1+ (instructions). The following instructions assume that you use Bash 4.1+ (that is, any Bash version of 4.1 or newer).

Install bash-completion v2:

brew install bash-completion@2
echo 'export BASH_COMPLETION_COMPAT_DIR="/usr/local/etc/bash_completion.d"' >>~/.bashrc
echo '[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"' >>~/.bashrc
exec bash # reload and replace (if it was updated) shell
type _init_completion && echo "completion is OK" # verify that bash-completion v2 is correctly installed

Add golangci-lint bash completion:

echo 'source <(golangci-lint completion bash)' >>~/.bashrc
source ~/.bashrc

@ldez ldez reopened this Dec 19, 2024
@ldez ldez added area: docs and removed declined labels Dec 19, 2024
@ldez ldez changed the title docs: update macOS completion guide docs: update completion guide Dec 19, 2024
@ldez ldez self-requested a review December 19, 2024 12:44
@ldez
Copy link
Member

ldez commented Dec 19, 2024

It's a better idea.

Copy link
Member

@ldez ldez left a comment

Choose a reason for hiding this comment

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

LGTM

@ldez ldez merged commit 7c81464 into golangci:master Dec 19, 2024
15 checks passed
@ldez ldez added the enhancement New feature or improvement label Dec 19, 2024
@ldez ldez added this to the next milestone Dec 19, 2024
@ldez ldez modified the milestones: next, v1.63 Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docs enhancement New feature or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants