nur-sery/nur_tbin/base/test-args1.php

63 lines
1.6 KiB
PHP
Raw Normal View History

2023-12-03 22:10:18 +04:00
<?php # -*- coding: utf-8 mode: php -*- vim:sw=2:sts=2:et:ai:si:sta:fenc=utf-8
2024-04-04 22:21:20 +04:00
require(__DIR__.'/../../vendor/autoload.php');
2023-12-03 22:10:18 +04:00
use nur\cli\Application;
use nur\out;
Application::run(new class extends Application {
const ARGS = [
["-c", "--common", "help" => "option commune"],
["one", "help" => "blah",
"cmd_args" => [
["-1", "--a", "help" => "un"],
["-2", "--b", "help" => "deux"],
],
],
["two", "help" => "blah blah",
"cmd_args" => [
["-3", "--c", "help" => "trois"],
["-4", "--d", "help" => "quatre"],
],
],
"sections" => [
[
"title" => "section 1",
["-s", "--shared", "help" => "option partagée"],
["three", "help" => "blah blah blah",
"cmd_args" => [
["-5", "--e", "help" => "cinq"],
["-6", "--f", "help" => "six"],
],
],
["four", "help" => "blah blah blah blah",
"cmd_args" => [
["-7", "--g", "help" => "sept"],
["-8", "--h", "help" => "huit"],
],
],
],
],
];
private $args;
private $command;
private $common, $a, $b, $c, $d, $shared, $e, $f, $g, $h;
function main() {
out::pnl("options", var_export([
"common" => $this->common,
"a" => $this->a,
"b" => $this->b,
"c" => $this->c,
"d" => $this->d,
"shared" => $this->shared,
"e" => $this->e,
"f" => $this->f,
"g" => $this->g,
"h" => $this->h,
], true));
out::pnl("args", var_export($this->args, true));
out::pnl("command", var_export($this->command, true));
}
});