def get_repo_table(ctx):
"""
:param onedrived.od_context.UserContext ctx:
:return dict[str, [onedrived.od_repo.OneDriveLocalRepository]]:
"""
all_accounts = {}
all_account_ids = ctx.all_accounts()
if len(all_account_ids) == 0:
logging.critical('onedrived is not linked with any OneDrive account. Please configure onedrived first.')
sys.exit(1)
for account_id in all_account_ids:
authenticator, drives = get_authenticator_and_drives(ctx, account_id)
local_repos = [od_repo.OneDriveLocalRepository(ctx, authenticator, d, ctx.get_drive(d.id))
for d in drives if d.id in ctx.config['drives']]
if len(local_repos) > 0:
all_accounts[account_id] = local_repos
else:
profile = ctx.get_account(account_id)
logging.info('No Drive associated with account "%s" (%s).', profile.account_email, account_id)
return all_accounts
评论列表
文章目录