nickderobertis / cliconf Goto Github PK
View Code? Open in Web Editor NEWFramework that lets you write CLIs with Typer that can also be configured via py-app-conf
License: MIT License
Framework that lets you write CLIs with Typer that can also be configured via py-app-conf
License: MIT License
I don't think this approach will work for command groups, need to add test case
Line 26 in 0b356f0
to inspect the passed arguments and load from config.
"""
command = typer_get_command(typer_instance)
# Add an option to generate the pyappconf config file, optionally providing a format
# TODO: I don't think this approach will work for command groups, need to add test case
# TODO: Add typing for configured commands
pyappconf_settings: AppConfig = command.callback.pyappconf_settings # type: ignore
cliconf_settings: CLIConfSettings = command.callback.cliconf_settings # type: ignore
model_cls: Type[BaseConfig] = command.callback.model_cls # type: ignore
command.params.append(
create_generate_config_option(
pyappconf_settings.supported_formats,
pyappconf_settings.default_format,
model_cls,
command.callback,
cliconf_settings.generate_config_option_name,
)
)
# Override the main function to load config
command.main = types.MethodType(_cli_conf_main, command)
return command
f122d29f92369cae3cbcae25873a4d1ef9730c4b
Add typing for configured commands
Line 27 in 0b356f0
to inspect the passed arguments and load from config.
"""
command = typer_get_command(typer_instance)
# Add an option to generate the pyappconf config file, optionally providing a format
# TODO: I don't think this approach will work for command groups, need to add test case
# TODO: Add typing for configured commands
pyappconf_settings: AppConfig = command.callback.pyappconf_settings # type: ignore
cliconf_settings: CLIConfSettings = command.callback.cliconf_settings # type: ignore
model_cls: Type[BaseConfig] = command.callback.model_cls # type: ignore
command.params.append(
create_generate_config_option(
pyappconf_settings.supported_formats,
pyappconf_settings.default_format,
model_cls,
command.callback,
cliconf_settings.generate_config_option_name,
)
)
# Override the main function to load config
command.main = types.MethodType(_cli_conf_main, command)
return command
f5e9a5c8efe55a48653822d815e94e67313b7009
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.