Commit d0e746e6 authored by segfault's avatar segfault

Improve onionkitctl

- Remove unnecessary bus argument
- Remove unnecessary exception handling
parent 110b5628
......@@ -34,7 +34,7 @@ class OptionNotFoundError(Exception):
pass
def _print_services(bus, service_paths):
def _print_services(service_paths):
for service_path in service_paths:
name = bus.get(BUS_NAME, service_path).Name
print("-", name)
......@@ -42,22 +42,22 @@ def _print_services(bus, service_paths):
def list_services():
service_paths = bus.get(BUS_NAME).GetServices()
_print_services(bus, service_paths)
_print_services(service_paths)
def list_installed():
service_paths = bus.get(BUS_NAME).GetServices()
_print_services(bus, (s for s in service_paths if bus.get(BUS_NAME, s).IsInstalled))
_print_services((s for s in service_paths if bus.get(BUS_NAME, s).IsInstalled))
def list_running():
service_paths = bus.get(BUS_NAME).GetServices()
_print_services(bus, (s for s in service_paths if bus.get(BUS_NAME, s).IsRunning))
_print_services((s for s in service_paths if bus.get(BUS_NAME, s).IsRunning))
def list_published():
service_paths = bus.get(BUS_NAME).GetServices()
_print_services(bus, (s for s in service_paths if bus.get(BUS_NAME, s).IsPublished))
_print_services((s for s in service_paths if bus.get(BUS_NAME, s).IsPublished))
def print_properties(service: "OnionService"):
......@@ -183,13 +183,7 @@ def main():
logger.initialize(args.verbose, args.log_file)
logging.debug("args: %r", args)
try:
execute_command(args, parser)
except SystemExit:
pass
except:
logging.exception('Got exception on main handler')
sys.exit(1)
execute_command(args, parser)
if __name__ == "__main__":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment