24 lines
575 B
PHP
24 lines
575 B
PHP
<?php
|
|
namespace cli;
|
|
|
|
use nulib\app\cli\Application;
|
|
use nulib\cv;
|
|
use nulib\ext\tab\SsBuilder;
|
|
use nulib\ext\tab\SsReader;
|
|
use nulib\file;
|
|
use nulib\os\path;
|
|
|
|
class Csv2xlsxApp extends Application {
|
|
function main() {
|
|
$input = cv::not_null($this->args[0] ?? null, "input");
|
|
$inputname = path::filename($input);
|
|
$output = path::ensure_ext($inputname, ".xlsx", ".csv");
|
|
|
|
$reader = SsReader::with($input);
|
|
$builder = SsBuilder::with($output);
|
|
$builder->writeAll($reader);
|
|
$builder->build();
|
|
$builder->copyTo(file::writer($output), true);
|
|
}
|
|
}
|