arguments

This commit is contained in:
Marc Beninca 2021-10-10 19:02:34 +02:00 committed by Marc Beninca
parent 1857f0e1b0
commit 80e76995a5
5 changed files with 21 additions and 18 deletions

View file

@ -7,7 +7,7 @@ import local
import synchronization import synchronization
def build(args): def build():
# TODO identify # TODO identify
print('TODO identify') print('TODO identify')
# TODO extract # TODO extract
@ -18,7 +18,7 @@ def build(args):
print('TODO archive') print('TODO archive')
def check(args): def check():
# TODO prepare threads # TODO prepare threads
print('TODO prepare threads') print('TODO prepare threads')
# TODO run threads # TODO run threads
@ -27,20 +27,18 @@ def check(args):
print('TODO watch threads') print('TODO watch threads')
def info(args): def info():
print(local.Local(args)) print(local.Local())
def sync(args): def sync():
sync = synchronization.Synchronization(args) sync = synchronization.Synchronization()
print(sync) print(sync)
sync.run() sync.run()
def main(): def main():
args = arguments.parse() getattr(sys.modules[__name__], arguments.action)()
function = getattr(sys.modules[__name__], args[arguments.ACTION])
function(args)
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -85,5 +85,10 @@ compression applying to archive
D = parse() D = parse()
action = D[ACTION]
architectures = D[ARCHITECTURES] architectures = D[ARCHITECTURES]
directory = D[DIRECTORY]
remote = D[REMOTE]
subsystems = D[SUBSYSTEMS] subsystems = D[SUBSYSTEMS]
temporary = D[TEMPORARY]
threads = D[THREADS]

View file

@ -8,9 +8,9 @@ import repository
class Local(repository.Repository): class Local(repository.Repository):
def __init__(self, args): def __init__(self):
super().__init__(args[arguments.DIRECTORY]) super().__init__(arguments.directory)
self.temporary = args[arguments.TEMPORARY] self.temporary = arguments.temporary
self.load() self.load()
def load(self): def load(self):

View file

@ -9,8 +9,8 @@ import repository
class Remote(repository.Repository): class Remote(repository.Repository):
def __init__(self, args): def __init__(self):
super().__init__(args[arguments.REMOTE]) super().__init__(arguments.remote)
self.load() self.load()
def load(self): def load(self):

View file

@ -8,11 +8,11 @@ import remote
class Synchronization: class Synchronization:
def __init__(self, args): def __init__(self):
self.remote = remote.Remote(args) self.remote = remote.Remote()
self.repository = local.Local(args) self.repository = local.Local()
self.temporary = self.repository.get_temporary() self.temporary = self.repository.get_temporary()
self.threads = args[arguments.THREADS] self.threads = arguments.threads
def run(self): def run(self):
for architecture in self.remote.architectures: for architecture in self.remote.architectures: