Дана 24/09/03 12:47PM, meisne...@mailbox.org написа: > I need to use 'clang-format' program to format some code and I found > a package which contains it (llvm-17.0.6p5). However, after > installation, the program executable is named 'clang-format-17' > instead of 'clang-format'. [...]
Personally, I wrote this script[1] helper: #!/bin/sh exec /usr/bin/env PATH=/usr/local/bin:/usr/bin:/bin \ "$( ( commands=$(find /usr/bin /usr/local/bin \ -name "${0##*/}"'-[0-9][0-9]' -print) [ -n "$commands" ] || commands=$(printf "%s" "${0##*/}") printf "%s\n" "$commands" ) | sort -Vr | sed 1q )" $(printf "%s" "$*" | tr -d '\\\n`;$()') the way it works is that I have a ~/bin directory added to my path, and inside of it I symlink this script to ~/bin/clang-format, ~/bin/scan-build, ~/bin/scan-view etc. The script uses zeroth argument to determine which program to run. The "version" (the part after "-" in the regular program name, eg. "17" for clang-format-17) will be the largest version according to version sort (`sort -V`). [1]: https://git.sr.ht/~strahinja/dotfiles/tree/master/item/bin/llvm-find