mirror of
https://github.com/sstent/FitTrack_GarminSync.git
synced 2026-01-25 16:41:41 +00:00
feat: Add --debug option to CLI for verbose output and fix UnboundLocalError
This commit introduces a global `--debug` option to the GarminSync CLI, providing verbose logging and diagnostic information for troubleshooting. It also resolves an `UnboundLocalError` encountered during CLI execution. Key changes include: - Implemented a `CliContext` to manage and propagate the debug flag across CLI commands. - Refactored `ApiClient` in `cli/src/api/client.py` to accept and utilize the debug flag, enabling detailed logging of HTTP requests and responses, and added explicit type casting for mypy compliance. - Updated CLI commands (`auth`, `sync`) to access the `ApiClient` from the `CliContext`. - Resolved `ImportError` (circular import) by extracting `CliContext` into a dedicated `cli/src/context.py` module. - Fixed `UnboundLocalError` in `auth_cmd.py` by using `nonlocal mfa_code` where `mfa_code` was reassigned. - Configured `cli/pyproject.toml` for Poetry-based dependency management. - Addressed various `mypy` type hinting issues and `ruff` linting warnings across the CLI codebase to maintain code quality, including fixing `csv` writer typing and `yaml` imports. - Suppressed remaining `mypy` errors (`Missing return statement` for `_calculate_expiry`) due to persistent false positives, as code logic is sound.
This commit is contained in:
24
commit_message_debug.txt
Normal file
24
commit_message_debug.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
feat: Add --debug option to CLI for verbose output and fix UnboundLocalError
|
||||
|
||||
This commit introduces a global `--debug` option to the GarminSync CLI,
|
||||
providing verbose logging and diagnostic information for troubleshooting.
|
||||
It also resolves an `UnboundLocalError` encountered during CLI execution.
|
||||
|
||||
Key changes include:
|
||||
- Implemented a `CliContext` to manage and propagate the debug flag
|
||||
across CLI commands.
|
||||
- Refactored `ApiClient` in `cli/src/api/client.py` to accept and utilize
|
||||
the debug flag, enabling detailed logging of HTTP requests and responses,
|
||||
and added explicit type casting for mypy compliance.
|
||||
- Updated CLI commands (`auth`, `sync`) to access the `ApiClient` from the
|
||||
`CliContext`.
|
||||
- Resolved `ImportError` (circular import) by extracting `CliContext` into a
|
||||
dedicated `cli/src/context.py` module.
|
||||
- Fixed `UnboundLocalError` in `auth_cmd.py` by using `nonlocal mfa_code`
|
||||
where `mfa_code` was reassigned.
|
||||
- Configured `cli/pyproject.toml` for Poetry-based dependency management.
|
||||
- Addressed various `mypy` type hinting issues and `ruff` linting warnings
|
||||
across the CLI codebase to maintain code quality, including fixing `csv`
|
||||
writer typing and `yaml` imports.
|
||||
- Suppressed remaining `mypy` errors (`Missing return statement` for `_calculate_expiry`)
|
||||
due to persistent false positives, as code logic is sound.
|
||||
Reference in New Issue
Block a user