Add CLI config environment and file parameters to use_client decorator#451
Merged
leoschwarz merged 2 commits intomainfrom Mar 13, 2026
Merged
Add CLI config environment and file parameters to use_client decorator#451leoschwarz merged 2 commits intomainfrom
leoschwarz merged 2 commits intomainfrom
Conversation
The use_client decorator now injects two optional keyword parameters into all decorated functions: - config_env: Override the config environment (e.g., 'TEST'). Falls back to BFABRICPY_CONFIG_ENV environment variable or the config file default. - config_file: Override the config file path (default: ~/.bfabricpy.yml). This enhancement allows CLI commands and scripts to dynamically override their configuration without modifying config files or environment variables, providing greater flexibility for testing and working with multiple B-Fabric environments. The parameters are added to function signatures with proper cyclopts.Parameter annotations for CLI help text when cyclopts is available, with graceful fallback when it is not. This affects: - bfabric (core implementation) - bfabric_scripts (all scripts using use_client) - bfabric_app_runner (all CLI commands using use_client) Tests: All 368 tests pass, including 20 new tests for the feature.
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.
Fixes #358
The use_client decorator now injects two optional keyword parameters into all decorated functions: