ohmybash / oh-my-bash

A delightful community-driven framework for managing your bash configuration, and an auto-update tool so that makes it easy to keep up with the latest updates from the community.
https://ohmybash.github.io
MIT License
5.54k stars 626 forks source link

New: Chezmoi aliases and completions. #477

Closed ShubhamVerma1811 closed 9 months ago

ShubhamVerma1811 commented 9 months ago

Hey there, This PR adds the support for custom Chezmoi aliases and completion.

The completions code is straight from the output of the chezmoi completion bash command.

Do let me know for any changes.

cc: @twpayne

image

akinomyoga commented 9 months ago

The reason that the binary outputs dynamically generated completions is to make sure the version of the completion setting matches the version of the actual binary. If we save the actual completion codes in the Oh-My-Bash (OMB) repository, the version mismatch between chezmoi used to generate the completion file and chezmoi in the user's environment causes an issue. At least, the PR should look similar to PR #404, where chezmoi completion bash is dynamically called to obtain the completion setting matching the version of the actual binary.

On the other hand, bash-completion currently tries to create a database of dynamically generated completions:

chezmoi doesn't seem to be registered there, but you can in principle register it to bash-completion so the chezmoi completion is automatically loaded by bash-completion without specifying anything at the OMB side. Note that OMB automatically loads bash-completion when it detects bash-completion.

ShubhamVerma1811 commented 9 months ago

Thank you for the feedback @akinomyoga, I got your point and made the necessary changes

akinomyoga commented 9 months ago

Thanks for updating the PR. I am not now preparing a PR at bash-completion including chezmoi and other commands with dynamic completion settings.

akinomyoga commented 9 months ago

Could you check the lint error at New: Chezmoi aliases and completions. · ohmybash/oh-my-bash@9b4082b?

ShubhamVerma1811 commented 9 months ago

made the change, hopefully it passes

akinomyoga commented 9 months ago

Thanks for updating the PR. I am not preparing a PR at bash-completion including chezmoi and other commands with dynamic completion settings.

Sorry, this is a typo of "I am now preparing a PR at bash-completion".

akinomyoga commented 9 months ago

Opened a PR at bash-completion: https://github.com/scop/bash-completion/pull/1048

akinomyoga commented 9 months ago

Opened a PR at bash-completion: scop/bash-completion#1048

https://github.com/scop/bash-completion/pull/1048 has been merged.

akinomyoga commented 9 months ago

Thank you for your quick responses and updates! I've merged it.