<?php
namespace nur\mapper\csv;

use nur\mapper\base\mappers_command;
use nur\mapper\base\Tparams_command;

/**
 * Class Assoc2CsvMapper_command: classe de support pour construire une instance
 * de mapper pour une application recevant des commandes utilisateurs
 */
class Assoc2CsvMapper_command {
  use Tparams_command;

  const NAME = "assoc2csv";
  const DEF = [self::NAME,
    "help" => "convertir en CSV",
    "action" => [self::class, "create_command"],
    "cmd_args" => [
      "usage" => self::NAME,
      ["-o", "--param", "args" => "value",
        "action" => [self::class, "add_params"],
        "help" => "spécifier une option générique",
      ],
    ],
  ];

  /** @var Assoc2CsvMapper */
  protected static $command;

  static function create_command() {
    self::$command = mappers_command::add(new Assoc2CsvMapper());
  }
}