tadfisher / pass-otp

A pass extension for managing one-time-password (OTP) tokens
GNU General Public License v3.0
1.26k stars 86 forks source link

Use `command -v` instead of `which` #164

Closed zneix closed 2 years ago

zneix commented 2 years ago

This is a more correct approach to check if some command is present since it doesn't print anything to stdout if the command isn't present.Use command -v instead of which. This is focuses on suppressing the error messages produced by which:

zneix@uds ~/a/pass-otp (master)$ pass otp otp/discord
which: no otptool in (/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/zneix/.local/bin:/home/zneix/scripts:/home/zneix/.local/share/go/bin)
821264
zneix@uds ~/a/pass-otp (master)$

This is a more correct approach to check if some command is present since it doesn't print anything to stdout if the command isn't present. More reference: https://stackoverflow.com/a/37056347

Update version variable Last git release is 1.2.0 and the variable itself was outdated

Nevermind, duplicate of #116, #123, #159... I really think command -v is a better approach than which but oh well.