Fix symlink for bash completions - #1889
Conversation
|
The completions still dont work because they are generated for I can only think of changing the symlinks in ln -sf "/usr/bin/fd" "${DPKG_DIR}/usr/bin/fdfind"
"${DPKG_DIR}/usr/bin/fdfind" --gen-completions bash > autocomplete/fdfind.bash
"${DPKG_DIR}/usr/bin/fdfind" --gen-completions fish > autocomplete/fdfind.fish
"${DPKG_DIR}/usr/bin/fdfind" --gen-completions powershell > autocomplete/_fdfind.ps1
# Generate Zsh completion by substituting top row of static completion file
sed '1s/^#compdef fd/#compdef fdfind/' autocomplete/_fd > autocomplete/_fdfind
install -Dm644 autocomplete/fdfind.bash "${DPKG_DIR}/usr/share/bash-completion/completions/fdfind"
install -Dm644 autocomplete/fdfind.fish "${DPKG_DIR}/usr/share/fish/vendor_completions.d/fdfind.fish"
install -Dm644 autocomplete/_fdfind.ps1 "${DPKG_DIR}/usr/share/powershell/Modules/fdfind/_fdfind.ps1"
install -Dm644 autocomplete/_fdfind "${DPKG_DIR}/usr/share/zsh/vendor-completions/_fdfind"I am not sure if there is a better way to do this. |
|
I wonder if it would be better for the fdfind completions to call the fd completions, rather than duplicating them |
|
I agree that would be ideal. For bash the fdfind could look like: # Source fd completions
source /usr/share/bash-completion/completions/fd
# Complete with same options as fd
eval "$(complete -p fd | sed 's/ fd$/ fdfind/')"
# Or
#if [[ "${BASH_VERSINFO[0]}" -eq 4 && "${BASH_VERSINFO[1]}" -ge 4 || "${BASH_VERSINFO[0]}" -gt 4 ]]; then
# complete -F _fd -o nosort -o bashdefault -o default fdfind
#else
# complete -F _fd -o bashdefault -o default fdfind
#fiBash completions are evaluated lazily so a side efffect would be that the completions for similar apply to zsh #compdef fdfind
# Source completions from fd
source /usr/share/zsh/vendor-completions/_fd
# Register completions for fdfind
compdef _fd fdfindFor fish the complete -c fdfind --wraps fdThis seem to work without sourcing anything else. I am not sure about powershell. Could these completion files be generated in the Another direction could be to append the code snippets for registering the completions in the fd completion files and keeping the symlinks. |
|
That seems like a better approach to me, although I don't know how to do it for Powershell either. I think putting those in contrib/completions would be fine |
|
The current implementation looks good directionally, but there's a build gap that needs fixing before merge.
You'll need to add Makefile targets similar to: autocomplete/fdfind.bash: contrib/completion/fdfind.bash
knowledge.md $(comp_dir)
knowledge.md cp $< $@
autocomplete/fdfind.fish: contrib/completion/fdfind.fish
knowledge.md $(comp_dir)
knowledge.md cp $< $@
autocomplete/_fdfind: contrib/completion/_fdfind
knowledge.md $(comp_dir)
knowledge.md cp $< $@And add Otherwise the delegation approach (bash source + complete, zsh |
55a63b3 to
247a517
Compare
|
I updated the Makefile and tried to "mirror" the cicd to create and install the deb package successfully. I am not sure how to test the proper cicd. |
fd 10.5.0 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## Features - Add `--ignore-parent` option to override `--no-ignore-parent`, see #1958 (@tmchow) - Add `--exact` option to match the entire filename exactly (literal, non-substring). ## Bugfixes - Sanitize control characters and bidirectional override characters in filenames when output goes to a terminal, to prevent terminal escape-sequence injection. Also reject a placeholder as the executable for `--exec-batch`, while still allowing it for `--exec`. - Handle invalid working directories gracefully when using `--full-path`, see #1900 (@Xavrir). - Fire the "search pattern contains a path separator" diagnostic for any pattern containing `/`, not just patterns that happen to name an existing directory. Preserves the legacy Windows behaviour that also flags native `\` separators when the pattern resolves to a real directory. See #1873. - Also fire the "search pattern contains a path separator" diagnostic for `--and` patterns, not only the primary positional pattern. `--and` patterns are matched against the file name just like the primary pattern, so a path separator in them silently returned zero results. See #1873. - Fix bug where passing "-" as a directory argument didn't actually search that directory, see #849 (@Sean-Kenneth-Doherty). - Fix panic when `--changed-before`/`--changed-within` is given an out-of-range `@` Unix timestamp; the value is now rejected gracefully, see #2081 (@nikolauspschuetz). ## New Contributors * @liruiluo made their first contribution in sharkdp/fd#1924 * @Xavrir made their first contribution in sharkdp/fd#1917 * @rexkirshner made their first contribution in sharkdp/fd#1921 * @Rohan5commit made their first contribution in sharkdp/fd#1934 * @tmchow made their first contribution in sharkdp/fd#1959 * @YoshKoz made their first contribution in sharkdp/fd#1979 * @SAY-5 made their first contribution in sharkdp/fd#1975 * @skane-lukas made their first contribution in sharkdp/fd#1889 * @Sean-Kenneth-Doherty made their first contribution in sharkdp/fd#2006 * @stevenwalton made their first contribution in sharkdp/fd#2011 * @DeflateAwning made their first contribution in sharkdp/fd#1983 * @wyf027 made their first contribution in sharkdp/fd#2001 * @bonanza127 made their first contribution in sharkdp/fd#2040 * @mahirhir made their first contribution in sharkdp/fd#2036 * @parneetsingh022 made their first contribution in sharkdp/fd#2037 * @curious-rabbit made their first contribution in sharkdp/fd#1976 * @WilliamLeony made their first contribution in sharkdp/fd#2064 * @kobihikri made their first contribution in sharkdp/fd#2063 * @cmelaro made their first contribution in sharkdp/fd#2075 * @nikolauspschuetz made their first contribution in sharkdp/fd#2082 **Full Changelog**: https://github.com/sharkdp/fd/compare/v10.4.2...v10.5.0</pre> <p>View the full release notes at <a href="https://github.com/sharkdp/fd/releases/tag/v10.5.0">https://github.com/sharkdp/fd/releases/tag/v10.5.0</a>.</p> </details> <hr> See merge request: Harmonybrew/homebrew-core!17790
Problem
In the deb package a broken symlink is created for bash completions to the alias command
fdfind.Solution
Create static completion files that sources fd completions for fdfind for bash, zsh and fish
Install the completions in Makefile and create-deb.sh
Changes
fdfindincreate-debfrom./fd.bashto./fdCHANGELOG.mdwith the fix.fixes #1888