aboutsummaryrefslogtreecommitdiff
path: root/functions/check_install.fish
blob: 4c5da6cf23f96c14d11c400ab3d58894d3f5def7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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