update arguments

This commit is contained in:
Dimitris Zlatanidis 2014-11-08 04:44:36 +02:00
parent cfa02b5778
commit 47cc6ec0d0

View file

@ -45,26 +45,40 @@ from others.check import OthersUpgrade
from others.install import OthersInstall from others.install import OthersInstall
class case(object): class Case(object):
def __init__(self, package): def __init__(self, package):
self.package = package self.package = package
def sboinstall(self): def sbo_install(self):
SBoInstall(self.package).start() SBoInstall(self.package).start()
def slackinstall(self): def slack_install(self):
Slack(self.package, "stable").start() Slack(self.package, "stable").start()
def rlwinstall(self): def rlw_install(self):
OthersInstall(self.package, "rlw", "").start() OthersInstall(self.package, "rlw", "").start()
def alieninstall(self): def alien_install(self):
OthersInstall(self.package, "alien", "").start() OthersInstall(self.package, "alien", "").start()
def slackyinstall(self): def slacky_install(self):
OthersInstall(self.package, "slacky", "").start() OthersInstall(self.package, "slacky", "").start()
def sbo_upgrade(self):
SBoCheck().start()
def slack_upgrade(self):
Patches("stable").start()
def rlw_upgrade(self):
OthersUpgrade("rlw", "").start()
def alien_upgrade(self):
OthersUpgrade("alien", "").start()
def slacky_upgrade(self):
OthersUpgrade("slacky", "").start()
def main(): def main():
@ -75,7 +89,6 @@ def main():
repository = ["sbo", "slack", "rlw", "alien", "slacky"] repository = ["sbo", "slack", "rlw", "alien", "slacky"]
blacklist = BlackList() blacklist = BlackList()
queue = QueuePkgs() queue = QueuePkgs()
if len(args) == 0: if len(args) == 0:
usage() usage()
elif (len(args) == 1 and args[0] == "-h" or elif (len(args) == 1 and args[0] == "-h" or
@ -92,35 +105,35 @@ def main():
PackageManager(None).list(args[1]) PackageManager(None).list(args[1])
else: else:
usage() usage()
elif len(args) == 3 and args[0] == "-c": elif len(args) == 3 and args[0] == "-c" and args[2] == "--upgrade":
if args[1] == repository[0] and args[2] == "--upgrade": pkg = Case("")
SBoCheck().start() upgrade = {
elif args[1] == repository[1] and args[2] == "--upgrade": "sbo": pkg.sbo_upgrade,
version = "stable" "slack": pkg.slack_upgrade,
Patches(version).start() "rlw": pkg.rlw_upgrade,
elif args[1] == repository[2] and args[2] == "--upgrade": "alien": pkg.alien_upgrade,
OthersUpgrade(repository[2], "").start() "slacky": pkg.slacky_upgrade
elif args[1] == repository[3] and args[2] == "--upgrade": }
OthersUpgrade(repository[3], "").start() if args[1] in repository:
elif args[1] == repository[4] and args[2] == "--upgrade": upgrade[args[1]]()
OthersUpgrade(repository[4], "").start()
else: else:
usage() usage()
elif len(args) == 4 and args[0] == "-c": elif len(args) == 4 and args[0] == "-c" and args[3] == "--current":
if args[1] == repository[1] and args[3] == "--current": if args[1] == repository[1]:
Patches("current").start() Patches("current").start()
elif args[1] == repository[3] and args[3] == "--current": elif args[1] == repository[3]:
OthersUpgrade(repository[3], "current").start() OthersUpgrade(repository[3], "current").start()
else: else:
usage() usage()
elif len(args) == 3 and args[0] == "-s": elif len(args) == 3 and args[0] == "-s":
pkg = Case(args[2])
if args[1] in repository: if args[1] in repository:
install = { install = {
"sbo": case(args[2]).sboinstall, "sbo": pkg.sbo_install,
"slack": case(args[2]).slackinstall, "slack": pkg.slack_install,
"rlw": case(args[2]).rlwinstall, "rlw": pkg.rlw_install,
"alien": case(args[2]).alieninstall, "alien": pkg.alien_install,
"slacky": case(args[2]).slackyinstall "slacky": pkg.slacky_install
} }
install[args[1]]() install[args[1]]()
else: else: