core/cli: add --debug flag, add HPI_LOGS to docs

This commit is contained in:
Sean Breckenridge 2022-02-10 21:04:02 -08:00 committed by karlicoss
parent 7bf316eb9a
commit a791b25650
2 changed files with 8 additions and 1 deletions

View file

@ -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 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! 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]]. 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]].

View file

@ -486,13 +486,18 @@ def query_hpi_functions(
@click.group() @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 Human Programming Interface
Tool for HPI Tool for HPI
Work in progress, will be used for config management, troubleshooting & introspection 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 # 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/#group-invocation-without-command
# https://click.palletsprojects.com/en/7.x/commands/#multi-command-chaining # https://click.palletsprojects.com/en/7.x/commands/#multi-command-chaining