provide a default for --busname
authorHelmut Grohne <helmut@subdivi.de>
Fri, 28 Jun 2013 09:46:29 +0000 (11:46 +0200)
committerHelmut Grohne <helmut@subdivi.de>
Fri, 28 Jun 2013 09:46:29 +0000 (11:46 +0200)
onoff/dbusutils.py

index 6d1d837..5654c95 100644 (file)
@@ -9,13 +9,15 @@ from gi.repository import GObject
 logger = logging.getLogger("onoff.dbusutils")
 
 object_prefix = "/de/subdivi/onoff0"
+default_busname = "de.subdivi.onoff0"
 
 dbus_options = argparse.ArgumentParser(add_help=False)
 dbus_options.add_argument("--bus", default="session",
                           choices=("system", "session"),
                           help="which bus to use (default: %(default)s)")
-dbus_options.add_argument("--busname", type=str, required=True,
-                          help="which busname (i.e. client) to use")
+dbus_options.add_argument("--busname", type=str, default=default_busname,
+                          help="which busname (i.e. client) to use " +
+                               "(default: %(default)s)")
 dbus_options.add_argument("--device", type=str, required=True,
                           help="which device to control")
 
@@ -46,7 +48,7 @@ def socketpair():
     return s1, s3
 
 class OnoffControl(dbus.service.Object):
-    domain = "de.subdivi.onoff0"
+    domain = default_busname
     path = object_prefix
 
     def __init__(self, bus, name, device):