From 80e76995a5c97f5c676ea06d608f232a642cd08b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 10 Oct 2021 19:02:34 +0200 Subject: [PATCH] arguments --- __init__.py | 16 +++++++--------- arguments.py | 5 +++++ local.py | 6 +++--- remote.py | 4 ++-- synchronization.py | 8 ++++---- 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/__init__.py b/__init__.py index a895768..1390fa7 100755 --- a/__init__.py +++ b/__init__.py @@ -7,7 +7,7 @@ import local import synchronization -def build(args): +def build(): # TODO identify print('TODO identify') # TODO extract @@ -18,7 +18,7 @@ def build(args): print('TODO archive') -def check(args): +def check(): # TODO prepare threads print('TODO prepare threads') # TODO run threads @@ -27,20 +27,18 @@ def check(args): print('TODO watch threads') -def info(args): - print(local.Local(args)) +def info(): + print(local.Local()) -def sync(args): - sync = synchronization.Synchronization(args) +def sync(): + sync = synchronization.Synchronization() print(sync) sync.run() def main(): - args = arguments.parse() - function = getattr(sys.modules[__name__], args[arguments.ACTION]) - function(args) + getattr(sys.modules[__name__], arguments.action)() if __name__ == '__main__': diff --git a/arguments.py b/arguments.py index 482a885..fe93f23 100644 --- a/arguments.py +++ b/arguments.py @@ -85,5 +85,10 @@ compression applying to archive D = parse() +action = D[ACTION] architectures = D[ARCHITECTURES] +directory = D[DIRECTORY] +remote = D[REMOTE] subsystems = D[SUBSYSTEMS] +temporary = D[TEMPORARY] +threads = D[THREADS] diff --git a/local.py b/local.py index cbadd54..0f96b78 100644 --- a/local.py +++ b/local.py @@ -8,9 +8,9 @@ import repository class Local(repository.Repository): - def __init__(self, args): - super().__init__(args[arguments.DIRECTORY]) - self.temporary = args[arguments.TEMPORARY] + def __init__(self): + super().__init__(arguments.directory) + self.temporary = arguments.temporary self.load() def load(self): diff --git a/remote.py b/remote.py index c32ca56..36297cc 100644 --- a/remote.py +++ b/remote.py @@ -9,8 +9,8 @@ import repository class Remote(repository.Repository): - def __init__(self, args): - super().__init__(args[arguments.REMOTE]) + def __init__(self): + super().__init__(arguments.remote) self.load() def load(self): diff --git a/synchronization.py b/synchronization.py index 85be065..c4fa2b8 100644 --- a/synchronization.py +++ b/synchronization.py @@ -8,11 +8,11 @@ import remote class Synchronization: - def __init__(self, args): - self.remote = remote.Remote(args) - self.repository = local.Local(args) + def __init__(self): + self.remote = remote.Remote() + self.repository = local.Local() self.temporary = self.repository.get_temporary() - self.threads = args[arguments.THREADS] + self.threads = arguments.threads def run(self): for architecture in self.remote.architectures: