mirror of
https://github.com/sstent/FitTrack_GarminSync.git
synced 2026-01-25 08:35:23 +00:00
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.
25 lines
1.3 KiB
Plaintext
25 lines
1.3 KiB
Plaintext
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.
|