From e5d665865e7cc800bb4deecd6aedcf3015e65b10 Mon Sep 17 00:00:00 2001 From: Deposite Pirate Date: Mon, 16 Feb 2026 02:22:00 +0100 Subject: Best effort dependency resolution Add a new check_install function that checks if a tool is installed and tries to install it on a best effort basic. Modify all scripts that benefit from it. Small indentation and correctness fixes. modified: functions/7za.fish modified: functions/alert.fish new file: functions/check_install.fish modified: functions/lscmd.fish modified: functions/rchmod.fish modified: functions/renlow.fish modified: functions/rlsxattr.fish modified: functions/rsdos.fish modified: functions/rsmac.fish modified: functions/rsxattr.fish modified: functions/uz.fish --- functions/check_install.fish | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 functions/check_install.fish (limited to 'functions/check_install.fish') 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 -- cgit v1.3.1