From d3fae00e74d95b924dd7435d111ae61bb9694e5e Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 25 Feb 2019 20:22:29 -0500 Subject: [PATCH] Add a `configdir` cli option --- piker/cli.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/piker/cli.py b/piker/cli.py index 8c6be8de..21b51611 100644 --- a/piker/cli.py +++ b/piker/cli.py @@ -13,8 +13,8 @@ import trio import tractor from . import watchlists as wl -from .brokers import core, get_brokermod, data from .log import get_console_log, colorize_json, get_logger +from .brokers import core, get_brokermod, data, config from .brokers.core import maybe_spawn_brokerd_as_subactor, _data_mods log = get_logger('cli') @@ -53,8 +53,13 @@ def pikerd(loglevel, host, tl): @click.option('--broker', '-b', default=DEFAULT_BROKER, help='Broker backend to use') @click.option('--loglevel', '-l', default='warning', help='Logging level') +@click.option('--configdir', '-c', help='Configuration directory') @click.pass_context -def cli(ctx, broker, loglevel): +def cli(ctx, broker, loglevel, configdir): + if configdir is not None: + assert os.path.isdir(configdir), f"`{configdir}` is not a valid path" + config._override_config_dir(configdir) + # ensure that ctx.obj exists even though we aren't using it (yet) ctx.ensure_object(dict) ctx.obj.update({