make yum_pkgs plugin executable standalone

This commit is contained in:
brent s 2019-07-02 15:12:37 -04:00
parent c03cc74f55
commit 43b0a2a62c
1 changed files with 18 additions and 0 deletions

View File

@ -227,3 +227,21 @@ class Backup(object):
with open(self.output, 'wb') as f:
f.write(self.pkglist)
return()

if __name__ == '__main__':
import argparse
args = argparse.ArgumentParser(description = 'Parse and report installed packages')
args.add_argument('-x', '--no-explicit',
dest = 'explicit_only',
action = 'store_false',
help = ('If specified, catalogue ALL installed packages, '
'not ones only explicitly-installed (implies -i/--includes)'))
args.add_argument('-i', '--includes',
dest = 'include_deps',
action = 'store_true',
help = ('If specified, include packages installed as dependencies'))
args.add_argument('output',
help = 'The file to write the XML output to.')
args = vars(args.parse_args())
b = Backup(**args)