1299a0e99397bb437fd9f58c308d5ccc8fd3b945
5 require_once __DIR__
."/Version.php";
10 * Command line arguments
11 * @var pharext\CliArgs
16 * Output pharext vX.Y.Z header
19 printf("pharext v%s (c) Michael Wallner <mike@php.net>\n", VERSION
);
23 * Output command line help message
26 public function help($prog) {
27 printf("\nUsage:\n\n \$ %s", $prog);
32 foreach ($this->args
->getSpec() as $spec) {
33 if ($spec[3] & CliArgs
::REQARG
) {
34 if ($spec[3] & CliArgs
::REQUIRED
) {
45 printf(" [-%s]", implode("", array_column($flags, 0)));
47 foreach ($required as $req) {
48 printf(" -%s <arg>", $req[0]);
51 printf(" [-%s <arg>]", implode("|-", array_column($optional, 0)));
54 foreach ($this->args
->getSpec() as $spec) {
55 printf(" -%s|--%s %s", $spec[0], $spec[1], ($spec[3] & CliArgs
::REQARG
) ?
"<arg> " : (($spec[3] & CliArgs
::OPTARG
) ?
"[<arg>]" : " "));
56 printf("%s%s%s", str_repeat(" ", 16-strlen($spec[1])), $spec[2], ($spec[3] & CliArgs
::REQUIRED
) ?
" (REQUIRED)" : "");
57 if (isset($spec[4])) {
58 printf(" [%s]", $spec[4]);