summaryrefslogtreecommitdiff
path: root/src/frontend/cli/sisyphus-cli.py
blob: 5b7e3b2508540aeb69b5ebcb449b9042e56aae5d (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/python3

import sisyphus
import sys

sisyphus.check.update()
sisyphus.setjobs.start.__wrapped__() # undecorate
pkgList = sys.argv[2:]

if "__main__" == __name__:
    if sys.argv[1:]:
        if "--install" in sys.argv[1:]:
            if not pkgList:
                sys.exit("\n" + "Nothing to install, please provide at least one package name; quitting" + "\n")
            else:
                sisyphus.install.start(pkgList)
        elif "--uninstall" in sys.argv[1:]:
            if not pkgList:
                sys.exit("\n" + "Nothing to uninstall, please provide at least one package name; quitting" + "\n")
            else:
                sisyphus.uninstall.start(pkgList)
        elif "--force-uninstall" in sys.argv[1:]:
            if not pkgList:
                sys.exit("\n" + "Nothing to force uninstall, please provide at least one package name; quitting" + "\n")
            else:
                sisyphus.uninstallforce.start(pkgList)
        elif "--remove-orphans" in sys.argv[1:]:
            sisyphus.removeorphans.start()
        elif "--search" in sys.argv[1:]:
            if not pkgList:
                sys.exit("\n" + "Nothing to search, please provide at least one package name; quitting" + "\n")
            else:
                sisyphus.search.start(pkgList)
        elif "--update" in sys.argv[1:]:
            sisyphus.update.start()
        elif "--upgrade" in sys.argv[1:]:
            sisyphus.upgrade.start()
        elif "--rescue" in sys.argv[1:]:
            sisyphus.rescue.start()
        elif "--spmsync" in sys.argv[1:]:
            sisyphus.spmsync.start()
        elif "--sysinfo" in sys.argv[1:]:
            sisyphus.sysinfo.show()
        elif "--mirror" in sys.argv[1:]:
            if "--list" in sys.argv[2:]:
                sisyphus.mirror.printList()
            elif "--set" in sys.argv[2:]:
                if sys.argv[3:]:
                    sisyphus.mirror.setActive(sys.argv[3:])
                else:
                    sisyphus.help.show()
            else:
                sisyphus.help.show()
        elif "--branch=master" in sys.argv[1:]:
            if "--remote=gitlab" in sys.argv[2:]:
                sisyphus.branchinject.gitlabMaster()
            elif "--remote=pagure" in sys.argv[2:]:
                sisyphus.branchinject.pagureMaster()
            else:
                sisyphus.help.show()
        elif "--branch=next" in sys.argv[1:]:
            if "--remote=gitlab" in sys.argv[2:]:
                sisyphus.branchinject.gitlabNext()
            elif "--remote=pagure" in sys.argv[2:]:
                sisyphus.branchinject.pagureNext()
            else:
                sisyphus.help.show()
        elif "--help" in sys.argv[1:]:
            sisyphus.help.show()
    else:
        sisyphus.help.show()