Execute all commands.

    For every command that is found in replay/toDo, execute each of them
    and move the file to the replay/archive directory.
179123
def execute_replay() -> None:
    
    files = glob.glob('./replay/toDo/*')
    sorted_files = sorted(files, key=os.path.getctime)

    if not sorted_files:  # list is not empty
        LOG.debug('Found %s, beginning execution.', sorted_files)
        for command_file in sorted_files:
            with open(command_file, 'r') as command:
                cmd = command.read()
                LOG.debug('executing command: %s', cmd)
                resp = run([cmd, '-v', 'DEBUG'], shell=True, check=True)
                LOG.debug(resp)
                LOG.debug('moving %s to archive', command.name)
                move_command = 'mv {0} ./replay/archive/'.format(command.name)
                run(move_command, shell=True, check=True)
        LOG.info('LaunchDarkly is now up to date.')
    else:
        LOG.warning('No files found, nothing to replay.')
1239956
def execute
      args = ['rubocop'] + arguments
      todo = target_directory.join('.rubocop_todo.yml')

      replacements = []

      # if adding the .rb extension is enabled, remove the extension again from
      # any output so it matches the actual files names we are linting
      replacements << [/\.erb\.rb/, '.erb'] if rb_extension_enabled

      result = Dir.chdir(target_directory) do
        replacements.unshift([/^#{Regexp.quote(Dir.pwd)}/, current_directory.to_s])
        stdout, stderr, status = Open3.capture3(*args)

        munge_output(stdout, stderr, replacements)

        status.exitstatus
      end

      # copy the todo file back for the case where we've used --auto-gen-config
      FileUtils.cp(todo, current_directory) if todo.exist?

      result
    end
160190
def _archive(self):
        
        archive, archive_file = _retrieve_archive()

        if self.backup:
            self.backup.add_archive(archive)

        if archive:
            from topydo.commands.ArchiveCommand import ArchiveCommand
            command = ArchiveCommand(self.todolist, archive)
            command.execute()

            if archive.dirty:
                archive_file.write(archive.print_todos())
892838
def _run(self, name, *args, **kwargs):

        

        stdout = six.b('')
        cmd = getattr(self.git, name)

        # Ask cmd(...) to return a (status, stdout, stderr) tuple
        kwargs['with_extended_output'] = True

        # Execute command
        try:
            (_, stdout, _) = cmd(*args, **kwargs)
        except GitCommandError as error:
            # Add more meta-information to errors
            message = "'{0}' returned exit status {1}".format(
                ' '.join(str(c) for c in error.command),
                error.status
            )

            raise GitError(message, stderr=error.stderr, stdout=stdout)

        return stdout.strip()
1337955
def do_action(self, command, journal = True):
        

        cmd = 0; src = 1; path = 1; data = 2; dst = 2

        if journal is True:
            self.journal.write(json.dumps(command['undo']) + "\n")
            self.journal.flush()

        d = command['do']
        if   d[cmd] == 'copy':   shutil.copy(d[src], d[dst])
        elif d[cmd] == 'move':   shutil.move(d[src], d[dst])
        elif d[cmd] == 'backup': shutil.move(d[src], self.new_backup(d[src]))
        elif d[cmd] == 'write' :
            if callable(d[data]): d[data](d[path])
            else: file_put_contents(d[path], d[data])
1358885
def run(self):
        

        if self.args['add']:
            self.action_add()

        elif self.args['rm']:
            self.action_rm()

        elif self.args['show']:
            self.action_show()

        elif self.args['rename']:
            self.action_rename()

        else:
            self.action_run_command()
129398
public function execute()
    {
        //Now load all patches, and save the resulting changed patches for later (not used yet)
        $changed  = $this->patcher->uploadPatches($this->loader->getVersions()->getBuild());


        if ($changed) {
            $this->getBatch()->addMessage(sprintf($this->_('%d new or changed patch(es).'), $changed));
        }
    }
1300895
function exec() {

  var actions = {
    commands: {
      init: { action: _init },
      gen: { action: _gen },
      watch: { action: _watch },
      drift: { action: _watch },
      clean: { action: _clean }
    }
  };

  bag.command(__dirname, actions);
}
1019389
async def execute_command(self, command):
        """"""
        self.apply_future = asyncio.Future(loop=self.loop)

        entry = self.log.write(self.storage.term, command)
        asyncio.ensure_future(self.append_entries(), loop=self.loop)

        await self.apply_future
174181
def _execute(self, *args: str, **kwargs) -> tuple:
        ''''''
        process = self.execute(
            args=args, options=merge_dict(self.options, kwargs))
        command = ' '.join(process.args)
        if self._dev:
            output, error = process.communicate()
            print(
                "Debug Information",
                "Command: {!r}".format(command),
                "Output: {!r}".format(output.encode('utf-8')),
                "Error: {!r}".format(error.encode('utf-8')),
                sep='\n', end='\n{}\n'.format('=' * 80)
            )
        return process.communicate()
279030
public final void execute() throws MojoExecutionException,
			MojoFailureException {

		// If skip flag set then omit image generation
		if (isSkip()) {
			getLog().info("Skipping creation of image files");
		} else {

			// Run the dot command only if dot files have been changed
			Set<String> changedDotFiles = getChangedDotFiles();
			if (changedDotFiles != null && !changedDotFiles.isEmpty()) {
				if (!executeDot(changedDotFiles)) {
					throw new MojoExecutionException("Executing '" + command
							+ "' command failed");
				}
			}
		}
	}
1091439
def _execute(self, p_command, p_args):
        
        self._backup(p_command, p_args)

        command = p_command(
            p_args,
            self.todolist,
            output,
            error,
            input)

        if command.execute() != False:
            self._post_archive_action = command.execute_post_archive_actions
            return True

        return False
503361
function execute(command, callback){
  exec(command, function(error, stdout, stderr){ callback(error, stdout); });
}
339130
public function execute()
    {
        parent::execute();

        if (empty($this->optionFilename)) {
            output()->write(
                (new Format())
                    ->setContextualClass(Format::DANGER)
                    ->setString(language()->getLine('CLI_MAKE_COMMANDER_E_FILENAME'))
                    ->setNewLinesAfter(1)
            );

            exit(EXIT_ERROR);
        }

        if (strpos($this->optionPath, 'Commanders') === false) {
            $filePath = $this->optionPath . 'Commanders' . DIRECTORY_SEPARATOR . $this->optionFilename;
        } else {
            $filePath = $this->optionPath . $this->optionFilename;
        }

        $fileDirectory = dirname($filePath) . DIRECTORY_SEPARATOR;

        if ( ! is_dir($fileDirectory)) {
            mkdir($fileDirectory, 0777, true);
        }

        if (is_file($filePath)) {
            output()->write(
                (new Format())
                    ->setContextualClass(Format::DANGER)
                    ->setString(language()->getLine('CLI_MAKE_COMMANDER_E_EXISTS', [$filePath]))
                    ->setNewLinesAfter(1)
            );

            exit(EXIT_ERROR);
        }

        $className = prepare_class_name(pathinfo($filePath, PATHINFO_FILENAME));
        @list($namespaceDirectory, $subNamespace) = explode('Commanders', dirname($filePath));

        $classNamespace = loader()->getDirNamespace(
                $namespaceDirectory
            ) . 'Commanders' . (empty($subNamespace)
                ? null
                : str_replace(
                    '/',
                    '\\',
                    $subNamespace
                )) . '\\';

        $vars[ 'CREATE_DATETIME' ] = date('d/m/Y H:m');
        $vars[ 'NAMESPACE' ] = trim($classNamespace, '\\');
        $vars[ 'PACKAGE' ] = '\\' . trim($classNamespace, '\\');
        $vars[ 'CLASS' ] = $className;
        $vars[ 'FILEPATH' ] = $filePath;

        $phpTemplate = <<<PHPTEMPLATE
<?php
/**
 * Created by O2System Framework File Generator.
 * DateTime: CREATE_DATETIME
 */

// ------------------------------------------------------------------------

namespace NAMESPACE;

// ------------------------------------------------------------------------

use O2System\Framework\Http\Commander;

/**
 * Class CLASS
 *
 * @package PACKAGE
 */
class CLASS extends Commander
{
    /**
     * CLASS::index
     */
    public function index()
    {
        // TODO: Change the autogenerated stub
    }
}
PHPTEMPLATE;

        $fileContent = str_replace(array_keys($vars), array_values($vars), $phpTemplate);
        file_put_contents($filePath, $fileContent);

        if (is_file($filePath)) {
            output()->write(
                (new Format())
                    ->setContextualClass(Format::SUCCESS)
                    ->setString(language()->getLine('CLI_MAKE_COMMANDER_S_MAKE', [$filePath]))
                    ->setNewLinesAfter(1)
            );

            exit(EXIT_SUCCESS);
        }
    }
1131979
@Override
	public void execute() {
		if (this.batches.isEmpty())
			return;
		
		// Reset the collection before making the call to eliminate callback chatter when
		// the batches call back to the master.
		List<Batch> old = this.batches;
		
		// Reset our batches
		this.batches = new ArrayList<Batch>();
		this.queryBatch = null;
		
		for (Batch batch: old) {
			batch.execute();
		}
	}
1252463
def run(self, command):
        
        if isinstance(command, basestring):
            command = command.split()
        else:
            command = list(command)
        self.external.omero_cli(command)
260810
public function execute()
    {
        $hook = preg_replace('/rocketeer\.(commands|tasks)\.(.+)/', '$2', $this->event->getName());
        $hook = explode('.', $hook);
        $hook = $hook[1].'_'.$hook[0];

        $this->prepareThenSend($hook);
    }