From 2974934832db22122cb743c7caab0548f7ebe289 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Wed, 8 Jun 2022 17:09:54 +0200 Subject: [PATCH] add frappy command - frappy(
, ) changes main and stick (+addons) in one go - frappy_main(..) not longer deals with standard stick --- commands.py | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/commands.py b/commands.py index 372478b..e7b8f9b 100644 --- a/commands.py +++ b/commands.py @@ -125,6 +125,33 @@ def set_se_list(): frappy_config.set_envlist() +@usercommand +@helparglist('main [, stick [, addons]]') +def frappy(main=None, stick=None, addons=None): + """(re)start frappy server(s) with given configs and load setup if needed + + - without argument: list running frappy servers + - frappy(''): if available, the standard stick is added too + - frappy(''): the stick is removed too + - addons are not changed when not given! + """ + if main is not None: + all_cfg = frappy_start('main', main) + if stick is None: + if main: + stickcfg = main + 'stick' + if stickcfg in FrappyNode.available_cfg('stick'): + # if a default stick is available, start this also + stick = stickcfg + else: + stick = '' + if stick is not None: + all_cfg = frappy_stick('stick', stick) + if addons is not None: + all_cfg = frappy_stick('addons', addons) + session.log.info(all_info(all_cfg)) + + @usercommand @helparglist('cfg') def frappy_main(cfg=None): @@ -133,13 +160,7 @@ def frappy_main(cfg=None): - without argument: list running frappy servers - cfg = "": stop frappy_main server """ - all_cfg = frappy_start('main', cfg) - if cfg: - stickcfg = cfg + 'stick' - if stickcfg in FrappyNode.available_cfg('stick'): - # if a default stick is available, start this also - all_cfg = frappy_start('stick', stickcfg) - session.log.info(all_info(all_cfg)) + session.log.info(all_info(frappy_start('main', cfg))) @usercommand