make cli not require a running daemon for all commands

This commit is contained in:
sezanzeb 2021-01-11 01:01:48 +01:00 committed by sezanzeb
parent 98953368a9
commit 03f2e34c8f

View File

@ -87,6 +87,9 @@ def main(options, daemon):
if options.command not in [AUTOLOAD, START, STOP, HELLO, STOP_ALL]: if options.command not in [AUTOLOAD, START, STOP, HELLO, STOP_ALL]:
logger.error('Unknown command "%s"', options.command) logger.error('Unknown command "%s"', options.command)
if daemon is None:
sys.exit(0)
if options.command == AUTOLOAD: if options.command == AUTOLOAD:
daemon.stop() daemon.stop()
for device, preset in list(config.iterate_autoload_presets()): for device, preset in list(config.iterate_autoload_presets()):
@ -171,7 +174,4 @@ if __name__ == '__main__':
daemon = get_dbus_interface(fallback=False) daemon = get_dbus_interface(fallback=False)
if daemon is None:
sys.exit(0)
main(options, daemon) main(options, daemon)