Command line function to update and the a config.
545495
def update_config(configclass: type(Config)):
    """"""

    # we build the real click command inside the function, because it needs to be done
    # dynamically, depending on the config.

    # we ignore the type errors, keeping the the defaults if needed
    # everything will be updated anyway
    config = configclass()  # type: Config

    def print_list(ctx, param, value):
        # they do like that in the doc (http://click.pocoo.org/6/options/#callbacks-and-eager-options)
        # so I do the same... but I don't now why.
        # the only goal is to call __print_list__()
        if not value or ctx.resilient_parsing:
            return param

        config.__print_list__()

        ctx.exit()

    def show_conf(ctx, param, value):
        # see print_list
        if not value or ctx.resilient_parsing:
            return param

        config.__show__()

        ctx.exit()

    def reset(ctx, param, value):
        # see print_list
        if not value or ctx.resilient_parsing:
            return param

        click.confirm('Are you sure you want to reset ALL fields to the defaults ? This action is not reversible.', abort=True)

        # that doesn't exist
        configclass.__config_path__, config_path = '', configclass.__config_path__
        # So the file won't be opened and only the default will be loaded.
        config = configclass()
        # Thus we can save the defaults
        # To the right place again
        configclass.__config_path__ = config_path
        config.__save__()

        ctx.exit()

    def clean(ctx, param, value):
        # see print_list
        if not value or ctx.resilient_parsing:
            return param

        config.__save__()
        click.echo('Cleaned !')

        ctx.exit()

    @click.command(context_settings={'ignore_unknown_options': True})
    @click.option('-c', '--clean', is_eager=True, is_flag=True, expose_value=False, callback=clean,
                  help='Clean the file where the configutation is stored.')
    @click.option('-l', '--list', is_eager=True, is_flag=True, expose_value=False, callback=print_list,
                  help='List the availaible configuration fields.')
    @click.option('--reset', is_flag=True, is_eager=True, expose_value=False, callback=reset,
                  help='Reset all the fields to their default value.')
    @click.option('-s', '--show', is_eager=True, is_flag=True, expose_value=False, callback=show_conf,
                  help='View the configuration.')
    @click.argument('fields-to-set', nargs=-1, type=click.UNPROCESSED)
    def command(fields_to_set: 'Tuple[str]'):
        """
        I manage your configuration.

        If you call me with no argument, you will be able to set each field
        in an interactive prompt. I can show your configuration with -s,
        list the available field with -l and set them by --name-of-field=whatever.
        """

        # with a context manager, the config is always saved at the end
        with config:

            if len(fields_to_set) == 1 and '=' not in fields_to_set[0]:
                # we want to update a part of the config
                sub = fields_to_set[0]
                if sub in config:
                    if isinstance(config[sub], SubConfig):
                        # the part is a subconfig
                        prompt_update_all(config[sub])
                    else:
                        # TODO: dynamic prompt for one field
                        raise click.BadParameter('%s is not a SubConfig of the configuration')

                else:
                    raise click.BadParameter('%s is not a field of the configuration')

            elif fields_to_set:
                dct = {}
                for field in fields_to_set:
                    field, _, value = field.partition('=')
                    dct[field] = value
                # save directly what is passed if something was passed whitout the interactive prompt
                config.__update__(dct)
            else:
                # or update all
                prompt_update_all(config)

    # this is the real function for the CLI
    LOGGER.debug('start command')
    command()
    LOGGER.debug('end command')
309460
def update():
    """"""
    repo_directory = get_config()['repo_directory']
    os.chdir(repo_directory)
    click.echo("Check for updates...")

    local = subprocess.check_output('git rev-parse master'.split()).strip()
    remote = subprocess.check_output(
        'git ls-remote https://github.com/tldr-pages/tldr/ HEAD'.split()
    ).split()[0]
    if local != remote:
        click.echo("Updating...")
        subprocess.check_call('git checkout master'.split())
        subprocess.check_call('git pull --rebase'.split())
        build_index()
        click.echo("Update to the latest and rebuild the index.")
    else:
        click.echo("No need for updates.")
1017148
def update_args(self, args):
        

        for arg in vars(args):
            if self.get(arg) and getattr(args, arg) is not None:
                self._config[self.root_section][arg] = getattr(args, arg)
320421
def main(args=None):
    """"""

    Config.options, Config.args = parse(args)

    logger()

    if Config.options.aeidon or Config.options.fix:
        start_aeidon()
    else:
        start_srt()

    if Config.options.fix:
        sys.exit(0)

    if not Config.results:
        basenames = [os.path.basename(os.path.abspath(x)) for x in Config.args]
        print('Search of', basenames, 'returned no results.')

        # leave the terminal open long enough to read message
        if Config.options.gui:
            from time import sleep
            sleep(2)
686109
def update_file(finfo, sample_info, config):
    
    ffinal = filesystem.update_file(finfo, sample_info, config, pass_uptodate=True)

    _upload_dir_icommands_cli(config.get("dir"), config.get("folder"), config)
446034
def _update_settings(self, dialect):
        """"""

        # the first parameter is the dialect itself --> ignore
        for parameter in self.csv_params[2:]:
            pname, ptype, plabel, phelp = parameter

            widget = self._widget_from_p(pname, ptype)

            if ptype is types.TupleType:
                ptype = types.ObjectType

            digest = Digest(acceptable_types=[ptype])

            if pname == 'self.has_header':
                if self.has_header is not None:
                    widget.SetValue(digest(self.has_header))
            else:
                value = getattr(dialect, pname)
                widget.SetValue(digest(value))
1254473
def update_configuration(self):
        
        uri = "{}/configuration".format(self.data["uri"])
        result = self._helper.update({}, uri)
        self.refresh()

        return result
1326758
def update(self):
        
        configs, meta_changes = self.config_manager.determine_config_changes()
        self._process_config_changes(configs, meta_changes)
        self.supervisorctl('update')
903750
def update(self, *args, **kwargs):
        """"""
        self._call_helper("Updating", self.real.update, *args, **kwargs)
742348
def update_config! attr, val
      Execute.task_popen3(*override_a, "config #{attr} #{val}") do |i, o, e, t|
        return t.value
      end
    end
696879
def cmd_update(args):
    
    #args.output = None

    markov = load(MarkovText, args.state, args)
    read(args.input, markov, args.progress)
    if args.output is None:
        if args.type == SQLITE:
            save(markov, None, args)
        elif args.type == JSON:
            name, ext = path.splitext(args.state)
            tmp = name + '.tmp' + ext
            save(markov, tmp, args)
            replace(tmp, args.state)
    else:
        save(markov, args.output, args)
1124448
def set_command(value, parameter):
    
    conf = get_config_obj()

    section = "cli"
    if "." in parameter:
        section, parameter = parameter.split(".", 1)

    # ensure that the section exists
    if section not in conf:
        conf[section] = {}
    # set the value for the given parameter
    conf[section][parameter] = value

    # write to disk
    safeprint("Writing updated config to {}".format(conf.filename))
    conf.write()
182729
def main(config_file):
    """"""

    if not (os.path.exists(config_file) and os.path.isfile(config_file)):
        msg = "Missing or invalid config file {0}".format(config_file)
        raise ValueError(msg)

    print("Loading config file {0}.".format(config_file))

    # Use the appropriate network driver to connect to the device:
    driver = napalm.get_network_driver("eos")

    # Connect:
    device = driver(
        hostname="127.0.0.1",
        username="vagrant",
        password="vagrant",
        optional_args={"port": 12443},
    )

    print("Opening ...")
    device.open()

    print("Loading replacement candidate ...")
    device.load_replace_candidate(filename=config_file)

    # Note that the changes have not been applied yet. Before applying
    # the configuration you can check the changes:
    print("\nDiff:")
    print(device.compare_config())

    # You can commit or discard the candidate changes.
    try:
        choice = raw_input("\nWould you like to commit these changes? [yN]: ")
    except NameError:
        choice = input("\nWould you like to commit these changes? [yN]: ")
    if choice == "y":
        print("Committing ...")
        device.commit_config()
    else:
        print("Discarding ...")
        device.discard_config()

    # close the session with the device.
    device.close()
    print("Done.")
884041
function config (args, cb) {
  var action = args.shift()
  switch (action) {
    case "set": return set(args[0], args[1], cb)
    case "get": return get(args[0], cb)
    case "delete": case "rm": case "del": return del(args[0], cb)
    case "list": case "ls": return list(cb)
    case "edit": return edit(cb)
    default: return unknown(action, cb)
  }
}
315965
def update(self, command=None, **kwargs):
        
        if command is None:
            argparser = self.argparser
        else:
            argparser = self[command]

        for k,v in kwargs.items():
            setattr(argparser, k, v)
582514
def update_config(updated_project):
    '''
    

    '''

    home = os.path.expanduser('~')
    if os.path.isfile(os.path.join(home, '.transfer', 'config.yaml')):
        with open(os.path.join(home, '.transfer', 'config.yaml'), 'r') as fp:
            projects = yaml.load(fp.read())
        replace_index = -1
        for i, project in enumerate(projects):
            if project['name'] == updated_project['name']:
                replace_index = i

        if replace_index > -1:
            projects[replace_index] = updated_project
            store_config(projects)
        else:
            print('Not saving configuration')
            print(colored('Project: ' + updated_project['name'] + ' was not found in configured projects!', 'red'))

    else:
        print('Transfer is not configured.')
        print('Please run:')
        print('')
        print(colored('    transfer --configure', 'cyan'))
        return
300560
def update(self, *args, **kwargs):
        '''
        
        '''
        preprocess = kwargs.get('preprocess')
        for s in args:
            for e in s:
                self._dict_set(preprocess(e) if preprocess else e, True)