diff options
Diffstat (limited to 'functions/check_install.fish')
| -rw-r--r-- | functions/check_install.fish | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/functions/check_install.fish b/functions/check_install.fish new file mode 100644 index 0000000..4c5da6c --- /dev/null +++ b/functions/check_install.fish @@ -0,0 +1,27 @@ +function check_install -a tool -a package + +if test (count $argv) -lt 1 + return 1 +end + +if command -sq $tool + return 0 +end + +if not ask "$tool doesn't seem to be installed. Attempt to install it?" + return 1 +end + +if test -z $package + set package $tool +end + +pkgadd $package || return 1 + +if not command -sq $tool + return 1 +end + +return 0 + +end |
