# jc-importer/2.7.0/class/Common/Cli/Command.php

Import WP – CSV &amp; XML Import Export for WordPress, version 2.7.0. 42 lines.

- Page: https://pluginprobe.com/plugins/jc-importer/2.7.0/code/class/Common/Cli/Command.php
- Raw: https://pluginprobe.com/plugins/jc-importer/2.7.0/raw/class/Common/Cli/Command.php
- Modified: 2022-01-18T21:59:18+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/jc-importer/2.7.0/code/class/Common/Cli/Command.php#L10-L20`.

```php
<?php

namespace ImportWP\Common\Cli;

class Command
{
    public static function register()
    {
        \WP_CLI::add_command('importwp', 'ImportWP\Common\Cli\Command');
    }

    /**
     * Run a ImportWP Importer
     *
     * ## OPTIONS
     *
     * <importer-id>
     * : ID of an existing importer.
     *
     * [--debug]
     * : Log all php notices.
     *
     * ## EXAMPLES
     *
     *     wp importwp import 1
     *
     * @param array $args
     * @param array $assoc_args
     */
    public function import($args, $assoc_args)
    {
        $assoc_args['action']      = 'importwp';
        $assoc_args['importer_id'] = trim($args[0]);

        if (empty($assoc_args['importer_id'])) {
            \WP_CLI::error("You must provide an importer id.");
        }

        \WP_CLI::success("Import Complete");
    }
}

```
