From a791b2565092b8e353716631c434b37a91d0179e Mon Sep 17 00:00:00 2001 From: Sean Breckenridge Date: Thu, 10 Feb 2022 21:04:02 -0800 Subject: [PATCH] core/cli: add --debug flag, add HPI_LOGS to docs --- doc/SETUP.org | 2 ++ my/core/__main__.py | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/SETUP.org b/doc/SETUP.org index ac149e0..a10c9b3 100644 --- a/doc/SETUP.org +++ b/doc/SETUP.org @@ -191,6 +191,8 @@ HPI comes with a command line tool that can help you detect potential issues. Ru If you only have a few modules set up, lots of them will error for you, which is expected, so check the ones you expect to work. +If you're having issues with ~cachew~ or want to show logs to troubleshoot what may be happening, you can pass the debug flag (e.g., ~hpi --debug doctor my.module_name~) or set the ~HPI_LOGS~ environment variable (e.g., ~HPI_LOGS=debug hpi query my.module_name~) to print all logs, including the ~cachew~ dependencies. ~HPI_LOGS~ could also be used to silence ~info~ logs, like ~HPI_LOGS=warning hpi ...~ + If you have any ideas on how to improve it, please let me know! Here's a screenshot how it looks when everything is mostly good: [[https://user-images.githubusercontent.com/291333/82806066-f7dfe400-9e7c-11ea-8763-b3bee8ada308.png][link]]. diff --git a/my/core/__main__.py b/my/core/__main__.py index 15c20bf..ea854f8 100644 --- a/my/core/__main__.py +++ b/my/core/__main__.py @@ -486,13 +486,18 @@ def query_hpi_functions( @click.group() -def main() -> None: +@click.option("--debug", is_flag=True, default=False, help="Show debug logs") +def main(debug: bool) -> None: ''' Human Programming Interface Tool for HPI Work in progress, will be used for config management, troubleshooting & introspection ''' + # should overwrite anything else in HPI_LOGS + if debug: + os.environ["HPI_LOGS"] = "debug" + # for potential future reference, if shared state needs to be added to groups # https://click.palletsprojects.com/en/7.x/commands/#group-invocation-without-command # https://click.palletsprojects.com/en/7.x/commands/#multi-command-chaining