#!/usr/bin/php5 "--save", "--output" => "--save" ); $ctx = pipi_create_context(); $list = pipi_get_command_list(); for ($argi = 1; $argi < $argc; $argi++) { $arg = $argv[$argi]; if (isset($aliases[$arg])) $arg = $aliases[$arg]; if (substr($arg, 0, 2) == "--") { $cmd_name = substr($arg, 2); if (!isset($list[$cmd_name])) { die("unknown command $cmd_name\n"); } $cmd_argc = $list[$cmd_name]; if ($argi + $cmd_argc + 1 > $argc) { die("too few arguments for $cmd_name\n"); } switch ($cmd_argc) { case 0: $res = pipi_command($ctx, $cmd_name); break; case 1: $res = pipi_command($ctx, $cmd_name, $argv[$argi + 1]); break; default: die(); } if (!$res) { die("command $cmd_name failed\n"); } $argi += $cmd_argc; } else { if (!pipi_command($ctx, "load", $arg)) die("could not load $arg\n"); } } ?>