1
0
mirror of https://github.com/Foltik/dotfiles synced 2024-11-24 12:26:05 -05:00
dotfiles/lib/pacman.py

16 lines
416 B
Python
Raw Normal View History

2018-12-08 23:20:35 -05:00
import lib.proc as proc
2018-12-06 01:31:23 -05:00
def get_installed():
2018-12-08 23:20:35 -05:00
return [line.split(' ')[0] for line in pacman(['-Q']).split('\n')[:-1]]
2018-12-06 01:31:23 -05:00
def install(package):
2018-12-08 23:20:35 -05:00
output = pacman(['-S', package], True)
2018-12-06 01:31:23 -05:00
2018-12-08 23:20:35 -05:00
def install_all(packages):
output = pacman(['-S'] + packages, True)
2018-12-06 01:31:23 -05:00
2018-12-08 23:20:35 -05:00
def pacman(flags, sudo = False):
cmd = ['pacman', '--noconfirm'] + flags
subproc = proc.exec(cmd, sudo)
2018-12-08 23:20:35 -05:00
return proc.communicate(subproc, cmd)