The CLI can take forms like:
 preempt
 preempt delay minimum 3 reload 10 sync 15
779733
def preempt_get
      hash = {}
      hash[:preempt] = default_preempt
      hash[:minimum] = default_preempt_delay_minimum
      hash[:reload] = default_preempt_delay_reload
      hash[:sync] = default_preempt_delay_sync
      arr = config_get('interface_hsrp_group', 'preempt', @get_args)
      if arr
        hash[:preempt] = true
        hash[:minimum] = arr[0]
        hash[:reload] = arr[1]
        hash[:sync] = arr[2]
      end
      hash
    end
708228
def _submit_and_wait(cmd, cores, config, output_dir):
    
    batch_script = "submit_bcl2fastq.sh"
    if not os.path.exists(batch_script + ".finished"):
        if os.path.exists(batch_script + ".failed"):
            os.remove(batch_script + ".failed")
        with open(batch_script, "w") as out_handle:
            out_handle.write(config["process"]["bcl2fastq_batch"].format(
                cores=cores, bcl2fastq_cmd=" ".join(cmd), batch_script=batch_script))
        submit_cmd = utils.get_in(config, ("process", "submit_cmd"))
        subprocess.check_call(submit_cmd.format(batch_script=batch_script), shell=True)
        # wait until finished or failure checkpoint file
        while 1:
            if os.path.exists(batch_script + ".finished"):
                break
            if os.path.exists(batch_script + ".failed"):
                raise ValueError("bcl2fastq batch script failed: %s" %
                                 os.path.join(output_dir, batch_script))
            time.sleep(5)
1018336
def cli(env, volume_id, schedule_type):
    """"""

    if (schedule_type not in ['INTERVAL', 'HOURLY', 'DAILY', 'WEEKLY']):
        raise exceptions.CLIAbort(
            '--schedule-type must be INTERVAL, HOURLY, DAILY, or WEEKLY')

    block_manager = SoftLayer.BlockStorageManager(env.client)
    disabled = block_manager.disable_snapshots(volume_id, schedule_type)

    if disabled:
        click.echo('%s snapshots have been disabled for volume %s'
                   % (schedule_type, volume_id))
283564
def start(**kwargs):
  '''  '''

  output, err = cli_syncthing_adapter.start(**kwargs)
  click.echo("%s" % output, err=err)
680159
def reload_():
    '''
    
    '''

    ret = {'comment': [],
           'result': True}

    # If there a schedule defined in pillar, refresh it.
    if 'schedule' in __pillar__:
        out = __salt__['event.fire']({}, 'pillar_refresh')
        if out:
            ret['comment'].append('Reloaded schedule from pillar on minion.')
        else:
            ret['comment'].append('Failed to reload schedule from pillar on minion.')
            ret['result'] = False

    # move this file into an configurable opt
    sfn = '{0}/{1}/schedule.conf'.format(__opts__['config_dir'], os.path.dirname(__opts__['default_include']))
    if os.path.isfile(sfn):
        with salt.utils.files.fopen(sfn, 'rb') as fp_:
            try:
                schedule = salt.utils.yaml.safe_load(fp_)
            except salt.utils.yaml.YAMLError as exc:
                ret['comment'].append('Unable to read existing schedule file: {0}'.format(exc))

        if schedule:
            if 'schedule' in schedule and schedule['schedule']:
                out = __salt__['event.fire']({'func': 'reload', 'schedule': schedule}, 'manage_schedule')
                if out:
                    ret['comment'].append('Reloaded schedule on minion from schedule.conf.')
                else:
                    ret['comment'].append('Failed to reload schedule on minion from schedule.conf.')
                    ret['result'] = False
            else:
                ret['comment'].append('Failed to reload schedule on minion.  Saved file is empty or invalid.')
                ret['result'] = False
        else:
            ret['comment'].append('Failed to reload schedule on minion.  Saved file is empty or invalid.')
            ret['result'] = False
    return ret
1299921
function later (info) {
	process.stdin.resume();
	const action = start.bind(null, info);
	process.on('SIGINT', action);
	process.on('SIGTERM', action);

	(function wait () {
		if (beenthere) {
			return;
		}

		setTimeout(wait, EVENT_LOOP);
	}());
}
691979
def set_prompt(self):
        """"""
        # No right prompt
        command_line = b'PS2=;RPS1=;RPROMPT=;'
        command_line += b'PROMPT_COMMAND=;'
        command_line += b'TERM=ansi;'
        command_line += b'unset HISTFILE;'
        prompt1, prompt2 = callbacks.add(b'prompt', self.seen_prompt_cb, True)
        command_line += b'PS1="' + prompt1 + b'""' + prompt2 + b'\n"\n'
        return command_line
304520
def cli(sequencepath, report, refseq_database):
    
    main(sequencepath, report, refseq_database, num_threads=multiprocessing.cpu_count())
144057
def reload(self):
        
        # Get reload mode
        reload_mode = self._reload_mode

        # If reload mode is `exec`
        if self._reload_mode == self.RELOAD_MODE_V_EXEC:
            # Call `reload_using_exec`
            self.reload_using_exec()

        # If reload mode is `spawn_exit`
        elif self._reload_mode == self.RELOAD_MODE_V_SPAWN_EXIT:
            # Call `reload_using_spawn_exit`
            self.reload_using_spawn_exit()

        # If reload mode is `spawn_wait`
        elif self._reload_mode == self.RELOAD_MODE_V_SPAWN_WAIT:
            # Call `reload_using_spawn_wait`
            self.reload_using_spawn_wait()

        # If reload mode is none of above
        else:
            # Get error message
            error_msg = 'Invalid reload mode: {}.'.format(repr(reload_mode))

            # Raise error
            raise ValueError(error_msg)
289894
def reload(self, reload_timeout=300, save_config=True):
        
        SAVE_CONFIG = re.compile(re.escape("System configuration has been modified. Save? [yes/no]: "))
        PROCEED = re.compile(re.escape("Proceed with reload? [confirm]"))
        IMAGE = re.compile("Passing control to the main image")
        BOOTSTRAP = re.compile("System Bootstrap")
        LOCATED = re.compile("Located .*")
        RETURN = re.compile(re.escape("Press RETURN to get started!"))

        response = "yes" if save_config else "no"

        #              0          1       2       3         4
        events = [SAVE_CONFIG, PROCEED, LOCATED, RETURN, self.username_re,
                  self.password_re, BOOTSTRAP, IMAGE, TIMEOUT, EOF]
        #              5              6          7       8      9

        transitions = [
            (SAVE_CONFIG, [0], 1, partial(a_send_line, response), 60),
            (PROCEED, [0, 1], 2, partial(a_send, "\r"), reload_timeout),
            (LOCATED, [2], 2, a_message_callback, reload_timeout),
            # if timeout try to send the reload command again
            (TIMEOUT, [0], 0, partial(a_send_line, self.reload_cmd), 10),
            (BOOTSTRAP, [2], -1, a_disconnect, reload_timeout),
            (IMAGE, [2], 3, a_message_callback, reload_timeout),
            (self.username_re, [3], -1, a_return_and_reconnect, 0),
            (self.password_re, [3], -1, a_return_and_reconnect, 0),
            (RETURN, [3], -1, a_return_and_reconnect, 0),
            (TIMEOUT, [2], -1, a_disconnect, 0),
            (EOF, [0, 1, 2, 3], -1, a_disconnect, 0)
        ]
        fsm = FSM("IOS-RELOAD", self.device, events, transitions, timeout=10)
        return fsm.run()
229818
def push(**kwargs):
  '''  '''

  output, err = cli_syncthing_adapter.refresh(**kwargs)

  if output:
    click.echo("%s" % output, err=err)

  if kwargs['verbose'] and not err:
    with click.progressbar(
      iterable=None,
      length=100,
      label='Synchronizing') as bar:

      device_num = 0
      max_devices = 1
      prev_percent = 0

      while True:
        kwargs['progress'] = True
        kwargs['device_num'] = device_num
        data, err = cli_syncthing_adapter.refresh(**kwargs)

        device_num = data['device_num']
        max_devices = data['max_devices']

        cur_percent = math.floor(data['percent']) - prev_percent
        if cur_percent > 0:
          bar.update(cur_percent)
          prev_percent = math.floor(data['percent'])

        if device_num < max_devices:
          time.sleep(0.5)
        else:
          break
950874
def reload(self, reload_timeout, save_config):
        """"""
        MAX_BOOT_TIME = 1800  # 30 minutes - TODO(klstanie): move to config
        RELOAD_PROMPT = re.compile(re.escape("Reload hardware module ? [no,yes]"))

        START_TO_BACKUP = re.compile("Status report.*START TO BACKUP")
        BACKUP_IN_PROGRESS = re.compile("Status report.*BACKUP INPROGRESS")

        BACKUP_HAS_COMPLETED_SUCCESSFULLY = re.compile("Status report.*BACKUP HAS COMPLETED SUCCESSFULLY")
        DONE = re.compile(re.escape("[Done]"))

        STAND_BY = re.compile("Please stand by while rebooting the system")
        CONSOLE = re.compile("con[0|1]/(?:RS?P)?[0-1]/CPU0 is now available")
        CONSOLE_STBY = re.compile("con[0|1]/(?:RS?P)?[0-1]/CPU0 is in standby")
        CONFIGURATION_COMPLETED = re.compile("SYSTEM CONFIGURATION COMPLETED")
        CONFIGURATION_IN_PROCESS = re.compile("SYSTEM CONFIGURATION IN PROCESS")
        BOOTING = re.compile("Booting IOS-XR 64 bit Boot previously installed image")

        #           0                 1              2                         3                          4     5
        events = [RELOAD_PROMPT, START_TO_BACKUP, BACKUP_IN_PROGRESS, BACKUP_HAS_COMPLETED_SUCCESSFULLY, DONE, BOOTING,
                  #   6                  7               8                     9                         10
                  CONSOLE, self.press_return_re, CONFIGURATION_COMPLETED, CONFIGURATION_IN_PROCESS, self.username_re,
                  # 11          12           13           14        15
                  EOF, pexpect.TIMEOUT, self.rommon_re, STAND_BY, CONSOLE_STBY]

        transitions = [
            # do I really need to clean the cmd
            (RELOAD_PROMPT, [0], 1, partial(a_send_line, "yes"), MAX_BOOT_TIME),
            (START_TO_BACKUP, [0, 1], 2, a_message_callback, 60),
            (BACKUP_IN_PROGRESS, [0, 1, 2], 2, a_message_callback, 90),
            (BACKUP_HAS_COMPLETED_SUCCESSFULLY, [0, 1, 2], 3, a_message_callback, 10),
            (DONE, [1, 2, 3], 4, None, MAX_BOOT_TIME),
            (STAND_BY, [2, 3, 4], 5, a_message_callback, MAX_BOOT_TIME),
            (self.rommon_re, [0, 4], 5, partial(a_send_boot, "boot"), MAX_BOOT_TIME),
            (BOOTING, [0, 1, 2, 3, 4], 5, a_message_callback, MAX_BOOT_TIME),
            (CONSOLE, [0, 1, 2, 3, 4, 5], 6, None, 600),
            (self.press_return_re, [6], 7, partial(a_send, "\r"), 300),
            (CONFIGURATION_IN_PROCESS, [7], 8, None, 180),
            (CONFIGURATION_COMPLETED, [8], -1, a_return_and_reconnect, 0),
            (CONSOLE_STBY, [5], -1, ConnectionStandbyConsole("Standby Console"), 0),
            (self.username_re, [9], -1, a_return_and_reconnect, 0),
            (EOF, [0, 1, 2, 3, 4, 5], -1, ConnectionError("Device disconnected"), 0),
            (pexpect.TIMEOUT, [7], 9, partial(a_send, "\r"), 180),
            (pexpect.TIMEOUT, [1, 5, 8], -1, ConnectionError("Boot process took more than {}s".format(MAX_BOOT_TIME)), 0),
            (pexpect.TIMEOUT, [9], -1, ConnectionAuthenticationError("Unable to reconnect after reloading"), 0)
        ]

        fsm = FSM("RELOAD", self.device, events, transitions, timeout=600)
        return fsm.run()
567332
def purge(self, ignore_ignores):
        """"""
        command = ['sync', '#none']
        if ignore_ignores:
            command.append('--no-ignore')
        d = self._dovccmd(command, collectStdout=True)

        # add deferred to rm tree

        # then add defer to sync to revision
        return d
468003
function (cmd, callback) {
    if (this.preLoadConditions.length === 0) {
      debug('no pre-load-condition for ' + this.name);
      return callback(null);
    }

    var self = this;
    async.eachSeries(this.preLoadConditions, function (preLoadCondition, callback) {
      if (preLoadCondition.version === undefined || preLoadCondition.version === null || preLoadCondition.version === self.version) {
        return preLoadCondition.check(cmd, callback);
      }
      callback(null);
    }, callback);
  }
1226254
def cli(env, volume_id, schedule_type, retention_count,
        minute, hour, day_of_week):
    """"""
    file_manager = SoftLayer.FileStorageManager(env.client)

    valid_schedule_types = {'INTERVAL', 'HOURLY', 'DAILY', 'WEEKLY'}
    valid_days = {'SUNDAY', 'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY',
                  'FRIDAY', 'SATURDAY'}

    if schedule_type not in valid_schedule_types:
        raise exceptions.CLIAbort(
            '--schedule-type must be INTERVAL, HOURLY, ' +
            'DAILY, or WEEKLY, not ' + schedule_type)

    if schedule_type == 'INTERVAL' and (minute < 30 or minute > 59):
        raise exceptions.CLIAbort(
            '--minute value must be between 30 and 59')
    if minute < 0 or minute > 59:
        raise exceptions.CLIAbort(
            '--minute value must be between 0 and 59')
    if hour < 0 or hour > 23:
        raise exceptions.CLIAbort(
            '--hour value must be between 0 and 23')
    if day_of_week not in valid_days:
        raise exceptions.CLIAbort(
            '--day_of_week value must be a valid day (ex: SUNDAY)')

    enabled = file_manager.enable_snapshots(volume_id, schedule_type,
                                            retention_count, minute,
                                            hour, day_of_week)

    if enabled:
        click.echo('%s snapshots have been enabled for volume %s'
                   % (schedule_type, volume_id))
282921
def cli(obj, name, email, password, status, text):
    """"""
    if not any([name, email, password, status, text]):
        click.echo('Nothing to update.')
        sys.exit(1)

    client = obj['client']
    try:
        r = client.update_me(name=name, email=email, password=password, status=status, attributes=None, text=text)
    except Exception as e:
        click.echo('ERROR: {}'.format(e))
        sys.exit(1)
    if r['status'] == 'ok':
        click.echo('Updated.')
    else:
        click.echo(r['message'])
164199
def cli(env, identifier, wait):
    """"""

    compute = SoftLayer.HardwareManager(env.client)
    compute_id = helpers.resolve_id(compute.resolve_ids, identifier,
                                    'hardware')
    ready = compute.wait_for_ready(compute_id, wait)
    if ready:
        env.fout("READY")
    else:
        raise exceptions.CLIAbort("Server %s not ready" % compute_id)