Skip to content

feat: add senior stock command#6

Merged
br-monteiro merged 10 commits into
mainfrom
feat/add-senior-stock-command
Mar 16, 2026
Merged

feat: add senior stock command#6
br-monteiro merged 10 commits into
mainfrom
feat/add-senior-stock-command

Conversation

@br-monteiro

Copy link
Copy Markdown
Member

This pull request introduces a new senior-stock command 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

  • Added the senior-stock command (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))
  • Added a detailed usage and configuration guide for senior-stock in commands/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))
  • Updated the main README.md to list the new senior-stock command and link to its documentation. ([README.mdR169-R177](https://github.com/quinta-serie/onecli/pull/6/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R169-R177))

API Integration & Caching

  • Implemented 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))
  • Introduced a simple, file-based cache system (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

  • Enhanced common/config.py to support layered configuration: settings from ~/.oneclirc can be overridden by ONECLI_* 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

  • Added comprehensive unit and integration tests for the senior-stock command, 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))

@br-monteiro br-monteiro self-assigned this Mar 16, 2026
@br-monteiro br-monteiro merged commit d2b770f into main Mar 16, 2026
1 check passed
@br-monteiro br-monteiro deleted the feat/add-senior-stock-command branch March 16, 2026 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant