joeytwiddle/jsh

require_exes could be smarter, loading the Apt/RPM or Node package to provide the exe

Opened this issue · 0 comments

require_exes is currently a way to quickly check for external dependencies, and abort if they are missing.

Example use in a #!/bin/sh script, ensure two audio programs are available:

require_exes bladeenc mp3info || exit 1

To use it in a #!/bin/bash script is a little simpler:

. require_exes bladeenc mp3info

Suggested enhancement: When we call require_exe (or perhaps via a global config file) we can tell it how to install that command if it is not present.

Then it could prompt the user to install the package that would provide the exe, so that the script can continue to run without issue.

(Storing the mapping from command_name to (packager,package_name) in a global file would be DRYer than declaring it on every include!)