diff --git a/my/core/influxdb.py b/my/core/influxdb.py index a5e950f..3800dae 100644 --- a/my/core/influxdb.py +++ b/my/core/influxdb.py @@ -132,16 +132,12 @@ def main() -> None: @main.command(name='populate', short_help='populate influxdb') @click.option('--reset', is_flag=True, help='Reset Influx measurements before inserting', show_default=True) -@click.argument('MODULE', type=str, required=True) -def populate(module: str, reset: bool) -> None: - from .stats import guess_data_providers - providers = guess_data_providers(module) - # meh.. encapsulate in guess_data_providers? - if 'inputs' in providers: - del providers['inputs'] - # todo could do interactive thing? same way as in hpi query - [(k, f)] = providers.items() - magic_fill(f, reset=reset) +@click.argument('FUNCTION_NAME', type=str, required=True) +def populate(function_name: str, reset: bool) -> None: + from .__main__ import _locate_functions_or_prompt + [provider] = list(_locate_functions_or_prompt([function_name])) + # todo could have a non-interactive version which populates from all data sources for the provider? + magic_fill(provider, reset=reset) # todo later just add to hpi main?