def web(ctx: Context, config_file: str): """Software Heritage web client""" import logging from swh.core import config from swh.web.client.client import WebAPIClient if not config_file: config_file = DEFAULT_CONFIG_PATH try: conf = config.read_raw_config(config.config_basepath(config_file)) if not conf: raise ValueError(f"Cannot parse configuration file: {config_file}") # TODO: Determine what the following conditional is for if config_file == DEFAULT_CONFIG_PATH: try: conf = conf["swh"]["web"]["client"] except KeyError: pass # recursive merge not done by config.read conf = config.merge_configs(DEFAULT_CONFIG, conf) except Exception: logging.warning("Using default configuration (cannot load custom one)", exc_info=True) conf = DEFAULT_CONFIG ctx.ensure_object(dict) ctx.obj["client"] = WebAPIClient(conf["api_url"], conf["bearer_token"])
def cli(ctx: Context, config_path: str, verbose: bool) -> None: """Command line interface main click entrypoint.""" ctx.ensure_object(dict) ctx.obj["config"] = load_config(config_path) ctx.obj["repo"] = get_repo(ctx.obj["config"]) load_logger(verbose)
def cli(ctx: ClickContext): if 'debian' not in Sys.id_like(): ctx.fail("Sorry, sutler only supports Debian based systems") app = ctx.ensure_object(App) if app.is_root(): ctx.fail("You're not allowed to run sutler as root") if ctx.invoked_subcommand is None: click.echo(ctx.get_help())
def cli(ctx: Context, config_path: str, verbose: bool) -> None: """Command line interface main click entrypoint.""" ctx.ensure_object(dict) ctx.obj["config"] = load_config(config_path) try: ctx.obj["drone"] except KeyError: ctx.obj["drone"] = load_drone() try: ctx.obj["aws"] except KeyError: ctx.obj["aws"] = load_aws() load_logger(verbose)
def main( ctx: Context, debug: bool, log: bool, locale: Optional[str] = None, account: Optional[str] = None, vin: Optional[str] = None, ) -> None: """Main entry point for the Renault CLI.""" ctx.ensure_object(dict) ctx.obj["credential_store"] = FileCredentialStore( os.path.expanduser(renault_settings.CREDENTIAL_PATH)) _check_for_debug(debug, log) if locale: ctx.obj["locale"] = locale if account: ctx.obj["account"] = account if vin: # pragma: no branch ctx.obj["vin"] = vin