mirror of https://github.com/tuhiproject/tuhi.git
kete: remove custom namespace class Args
We are using argparse in the various prompt function that already provide a NameSpace class. We can just reuse it instead of rebuilding everything. Given that we enforce/parse the type of the arguments, there is no need to do more processing.pull/41/head
parent
1d3bf40a8c
commit
08bdaffd89
|
@ -312,10 +312,6 @@ class TuhiKeteManager(_DBusObject):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Args(object):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class Worker(GObject.Object):
|
class Worker(GObject.Object):
|
||||||
"""Implements a command to be executed.
|
"""Implements a command to be executed.
|
||||||
Subclasses need to overwrite run() that will be executed
|
Subclasses need to overwrite run() that will be executed
|
||||||
|
@ -674,9 +670,7 @@ class TuhiKeteShell(cmd.Cmd):
|
||||||
break
|
break
|
||||||
return
|
return
|
||||||
|
|
||||||
wargs = Args()
|
self.start_worker(Listener, parsed_args)
|
||||||
wargs.address = address
|
|
||||||
self.start_worker(Listener, wargs)
|
|
||||||
|
|
||||||
def help_fetch(self):
|
def help_fetch(self):
|
||||||
self.do_fetch('-h')
|
self.do_fetch('-h')
|
||||||
|
@ -715,20 +709,7 @@ class TuhiKeteShell(cmd.Cmd):
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
return
|
return
|
||||||
|
|
||||||
address = parsed_args.address
|
self.start_worker(Fetcher, parsed_args)
|
||||||
index = parsed_args.index
|
|
||||||
|
|
||||||
if index != 'all':
|
|
||||||
try:
|
|
||||||
int(index)
|
|
||||||
except ValueError:
|
|
||||||
print(self._fetch_usage)
|
|
||||||
return
|
|
||||||
|
|
||||||
wargs = Args()
|
|
||||||
wargs.address = address
|
|
||||||
wargs.index = index
|
|
||||||
self.start_worker(Fetcher, wargs)
|
|
||||||
|
|
||||||
def help_search(self):
|
def help_search(self):
|
||||||
self.do_search('-h')
|
self.do_search('-h')
|
||||||
|
@ -755,9 +736,8 @@ class TuhiKeteShell(cmd.Cmd):
|
||||||
return
|
return
|
||||||
|
|
||||||
Searcher.interactive = False
|
Searcher.interactive = False
|
||||||
wargs = Args()
|
parsed_args.address = None
|
||||||
wargs.address = None
|
self.start_worker(Searcher, parsed_args)
|
||||||
self.start_worker(Searcher, wargs)
|
|
||||||
|
|
||||||
def help_pair(self):
|
def help_pair(self):
|
||||||
self.do_pair('-h')
|
self.do_pair('-h')
|
||||||
|
|
Loading…
Reference in New Issue