-
-
Notifications
You must be signed in to change notification settings - Fork 673
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
Replace which
with command -v
#239
Conversation
@nntoan can you take a look? |
I got the same problem in Debian sid. |
Thank you for the additional information. |
@nntoan can you please take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these are generally good fixes, but have you noticed the existing shell function type_exists
for this purpose? I feel we should update the definition of type_exists
to something more efficient like type -P "$@" &>/dev/null
or command -v "$@" &>/dev/null
and then use type_exists
everywhere, which is more consistent and idiomatic. What do you think?
I also found the uses of `type CommandName &>/dev/null': ./completions/docker-compose.completion.sh:42: type compopt &>/dev/null && compopt -o nospace
./completions/docker.completion.sh:409: type compopt &>/dev/null && compopt -o nospace
./completions/git.completion.sh:158:if ! type _get_comp_words_by_ref >/dev/null 2>&1; then
./lib/base.sh:117: if type "mkisofs" > /dev/null; then
./lib/base.sh:268: type "$1" &> /dev/null ;
./plugins/nvm/nvm.plugin.sh:8:if ! type "nvm" &> /dev/null; then
./plugins/sdkman/sdkman.plugin.sh:7:if ! type "sdk" &> /dev/null; then |
I think this is a good idea. Do you mean that we should update the builtin bash function somehow? Or, is |
Thank you for your reply! I meant the latter. Currently, the definition of |
I found a related PR #171. I think we need to care about the differences between the builtin commands that can be used to detect the commands. I summarized in the following table which command can detect each type of the commands.
Those different variations can be found here and there in the codebase, which I think should be made consistent. #171 implies that we might need to prepare several functions like Edit: Bash-it seems to prepare two shell functions, |
I have adopted the change made in #171 and then renamed It'd be great if you could also update other uses of |
Thank you so much @akinomyoga ! I will reply in detail once I return from holiday travel. I appreciate your collaboration and work very much. |
Thank you for your reply! OK! Have a good year and holidays! |
Ok, so looking back on your comments, I am very grateful for your collaboration. Now for the next step: You have made Let me see if I am understanding what I should do next:
Is that correct? |
Thank you!
Basically, yes. Additionally, the tests Also, the rewriting is not strict as I don't think the existing instances of these commands are so carefully chosen. E.g., if you think Also, be careful that some of the codes are supposed to be executed before loading |
I noticed a function |
@akinomyoga Thank you for your patience -- I have attempted to make the changes requested. What do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akinomyoga Thank you for your patience -- I have attempted to make the changes requested. What do you think?
Great! Thank you for your work! I have comments as follows. Could you check them?
@mchaker Hi! If you are busy, I think I can take over the remaining changes in this PR. What do you think? Thank you! |
@akinomyoga Hi Koichi! I apologize for the radio silence. I am still willing to finish the changes -- will go through the requested changes now. |
@mchaker The changes are still incomplete for a long time. Or are you still working on it? Can I take over this PR? |
@akinomyoga Yes, you can take over this PR. Thank you for your patience, I wish I could have completed it sooner. |
Thanks! |
ohmybash#239 (comment) Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
I've squashed related commits and fixed the present problems. There are many conflicts. I'm going to rebase it to the latest |
`which` has been deprecated in Debian (at least, the rolling release installed on chromebooks via Linux Containers) ohmybash#239 (comment) Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
ohmybash#239 (comment) Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
rebase done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the list of _omb_util_command_exists
that has originally been which
. I think it is better to make them _omb_util_binary_exists
. See also #239 (comment).
`which` has been deprecated in Debian (at least, the rolling release installed on chromebooks via Linux Containers) ohmybash#239 (comment) Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
ohmybash#239 (comment) Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
`which` has been deprecated in Debian (at least, the rolling release installed on chromebooks via Linux Containers) ohmybash#239 (comment) Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
ohmybash#239 (comment) Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
@mchaker I think I have finished the changes that I mentioned before. Also, I have added some other changes and adjustments. I'll keep this PR open for a while. If you have any comments on the updated version of the PR, please feel free to leave them here. @nntoan Could you review the PR? The repository setting seems to have been changed recently so that any approval is needed to merge the PR. (I can actually self-approve my changes and forcibly merge the PR, but that doesn't seem like the neat way.) We have unified all the existence tests of commands (which varied to use |
@nntoan Can I merge the PR if there are no comments or concerns? |
@akinomyoga Hey, yap seems all good to me. This can be merged, forgot to reply the thread earlier. |
@nntoan Thank you very much for the quick reply! Edit: I have merged it! |
🙌🙏🥳 thank you so much! |
Debian has deprecated usage of
which
, as per:https://salsa.debian.org/debian/debianutils/-/commit/3a8dd10b4502f7bae8fc6973c13ce23fc9da7efb
The recommendation is now to use
command -v
.