示例#1
0
def update_Sync_settings(gist=None, auth=None):
    config = Config('sync_settings')
    data = config.readData()
    if gist is not None:
        data.update(gist=gist.strip())
        click.echo(td(text=f"Saved Gist ID: [<{gist}>]."))
    if auth is not None:
        data.update(auth=auth.strip())
        click.echo(td(text=f"Saved auth: [<{auth}>]."))
    config.saveData(data)
示例#2
0
def write_settings(data, settings):
    """
    write all the config files to conf folder.
    """
    if settings == 'conf':
        for name, settings in data.items():
            if name != 'sync_settings':
                config = Config(name)
                config.saveData(settings)
                click.echo(
                    td(text=
                       f"<g>Success!</g> <y>{name}</y> configuration imported."
                       ))
    elif settings == 'plugin':
        for name, txt in data.items():
            with open(os.path.join(plugin_folder, name), 'wt') as f:
                f.write(txt)
            click.echo(
                td(text=f"<g>Success!</g> Plugin <y>{name[:-3]}</y> imported.")
            )