<?php
namespace nur\mapper\csv;

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

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

  const NAME = "csv2assoc";
  const DEF = [self::NAME, 
    "help" => "analyser un flux 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 Csv2AssocMapper */
  protected static $command;

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