#!/usr/bin/env python3

import sys

from os2borgerpc.client.config import OS2borgerPCConfig
from os2borgerpc.client.admin_client import get_default_admin
try:
    config = OS2borgerPCConfig()
    to_push = {}
    for name in sys.argv[1:]:
        to_push[name] = config.get_value(name)
    if(to_push):
        admin = get_default_admin()
        admin.push_config_keys(config.get_value('uid'), to_push)
        print("The following keys were pushed to the admin system:\n\t%s" % (
            ' '.join(sorted(to_push.keys()))
        ))
except Exception as e:
    print("Error pushing config keys: ", str(e))
