<?php
namespace nur\mapper\app;

use nur\cli\Application;
use nur\mapper\base\mappers_command;

class DatareaderApp extends Application {
  const ARGS = [
    "purpose" => "GĂ©rer un flux csv",
    "usage" => "[-f input] [-o output]",

    "dynamic_command" => datareader_command::class,
    "autoremains" => false,

    "sections" => [
      Application::VERBOSITY_SECTION,
    ],
    datareader_command::IF_OPTION,
    datareader_command::IFO_OPTION,
    datareader_command::IE_OPTION,
    datareader_command::OF_OPTION,
    datareader_command::OFO_OPTION,
    datareader_command::OE_OPTION,
    ["args" => [["value"]], "action" => [datareader_command::class, "set_input_file"]],
  ];

  function main() {
    [$producer, $consumer] = datareader_command::get();

    $consumer->setUseTmpfile($producer->getInput());
    $consumer->consume($producer, ...mappers_command::$mappers);
  }
}