<commit_before><?hh //strict

/**
 * This file is part of hhpack/migrate.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace HHPack\Migrate\Application;

use HHPack\Getopt as cli;
use HHPack\Getopt\Parser\{ OptionParser };
use HHPack\Migrate\{ Migrator, SqlMigrationLoader, DatabaseClient };
use RuntimeException;

final class DownCommand extends AbstractCommand implements Command
{

    public function __construct()
    {
        $this->usage = "migrate down [OPTIONS] [NAME]";
        $this->description = "Downgrade the schema of the database";
        $this->optionParser = cli\optparser([
            cli\on(['-h', '--help'], 'Display help message', () ==> {
                $this->help = true;
            })
        ]);
    }

    public function run(Context $context): void
    {
        $remainArgs = $this->optionParser->parse($context->cliArgs());
        $args = Vector::fromItems($remainArgs);

        if (!$args->containsKey(0)) {
            throw new RuntimeException('Please specify the version to downgrade');
        }

        $schemaVersion = $args->at(0);<commit_msg>fix parse arguments<commit_after><?hh //strict

/**
 * This file is part of hhpack/migrate.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace HHPack\Migrate\Application;

use HHPack\Getopt as cli;
use HHPack\Getopt\Parser\{ OptionParser };
use HHPack\Migrate\{ Migrator, SqlMigrationLoader, DatabaseClient };
use RuntimeException;

final class DownCommand extends AbstractCommand implements Command
{

    public function __construct()
    {
        $this->usage = "migrate down [OPTIONS] [NAME]";
        $this->description = "Downgrade the schema of the database";
        $this->optionParser = cli\optparser([
            cli\on(['-h', '--help'], 'Display help message', () ==> {
                $this->help = true;
            })
        ]);
    }

    public function run(Context $context): void
    {
        $remainArgs = $this->optionParser->parse($context->cliArgs());

        if (!$remainArgs->containsKey(0)) {
            throw new RuntimeException('Please specify the version to downgrade');
        }

        $schemaVersion = $remainArgs->at(0);
{'fraction_non_alphanumeric': 0.1327134404057481, 'fraction_numerical': 0.0016906170752324597, 'mean_word_length': 2.817741935483871, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5192230', 'n_tokens_mistral': 685, 'n_tokens_neox': 682, 'n_words': 197}