feat: add senior stock command#6
Merged
Merged
Conversation
…amples and configuration details
… stock command details
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new
senior-stockcommand to the CLI tool, enabling users to fetch and display stock data from the Senior stock API with flexible filtering, column selection, and caching. The implementation includes robust configuration management, a file-based cache system, and comprehensive tests to ensure reliability and usability.The most important changes are:
New Command: Senior Stock
senior-stockcommand (commands/senior-stock/__init__.py) that fetches and displays stock data from the Senior stock API, supporting filter expressions (exact and regex), column selection, and cache bypassing. ([commands/senior-stock/__init__.pyR1-R92](https://github.com/quinta-serie/onecli/pull/6/files#diff-f1f0cdbd401eaa2a3598ea19d73dca4baa19cd492600352d2fcf055ebbe62547R1-R92))senior-stockincommands/senior-stock/README.md, including environment variable overrides and example invocations. ([commands/senior-stock/README.mdR1-R122](https://github.com/quinta-serie/onecli/pull/6/files#diff-a34f6a0c88561e7ee5caa6fe6bd214ef9630132ffdfc8df09b1f10f644e874d1R1-R122))README.mdto list the newsenior-stockcommand and link to its documentation. ([README.mdR169-R177](https://github.com/quinta-serie/onecli/pull/6/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R169-R177))API Integration & Caching
SeniorStockAPI(commands/senior-stock/senior_stock_api.py) to handle authentication (with token caching and refresh), stock data retrieval (with response caching and retries), and configuration validation. ([commands/senior-stock/senior_stock_api.pyR1-R100](https://github.com/quinta-serie/onecli/pull/6/files#diff-affde435499a2527fb33164f3adb7b73f56345df95a93e524061c086e79fd962R1-R100))common/cache.py) with optional TTL, used for both API tokens and stock data. ([common/cache.pyR1-R49](https://github.com/quinta-serie/onecli/pull/6/files#diff-edf1124cf784fc7a1708133d574fb6e1fa35b25dac8d97f5ca1c2a81e7bd91cbR1-R49))Configuration Management
common/config.pyto support layered configuration: settings from~/.oneclirccan be overridden byONECLI_*environment variables, with correct precedence and merging for command-specific settings. ([[1]](https://github.com/quinta-serie/onecli/pull/6/files#diff-1bacff878451e5aa9c6d164150c7b2daad028d5e7acba90bb720cb73ffdd827bL24-R26),[[2]](https://github.com/quinta-serie/onecli/pull/6/files#diff-1bacff878451e5aa9c6d164150c7b2daad028d5e7acba90bb720cb73ffdd827bR39-R45),[[3]](https://github.com/quinta-serie/onecli/pull/6/files#diff-1bacff878451e5aa9c6d164150c7b2daad028d5e7acba90bb720cb73ffdd827bL57-R60))Testing
senior-stockcommand, covering filter parsing, column selection, CLI argument handling, and output validation (tests/commands/senior-stock/test_command.py). ([tests/commands/senior-stock/test_command.pyR1-R294](https://github.com/quinta-serie/onecli/pull/6/files#diff-60adf3d923867f479cbe3a4d3fdb9fad06d17ea55d2fcadf53a51f20aa0bdd95R1-R294))