12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- include ('api.1984tech.php');
- $tech = new OrwellWorld();
- //need at least 1 command line argument
- if ($argc >= 2) {
- $allowedOptions = array(
- '--preview' => 'preview JunOS address list update script to stdout',
- '--resolve' => 'render IPs list of loaded domains',
- '--help' => 'show small help'
- );
- $option = $argv[1];
- if (isset($allowedOptions[$option])) {
- switch ($option) {
- case '--preview':
- print($tech->getJunosScript());
- break;
- case '--resolve':
- print($tech->renderDomainsIps());
- break;
- case '--help':
- print('Usage: php cli/jungen --option' . PHP_EOL);
- print('Available options:' . PHP_EOL);
- if (!empty($allowedOptions)) {
- foreach ($allowedOptions as $optionName => $optionDesc) {
- print($optionName . ' - ' . $optionDesc . PHP_EOL);
- }
- }
- break;
- }
- } else {
- print('Unknown command line option: ' . $option . PHP_EOL);
- }
- } else {
- //option requirement notification
- print('At least one option required.' . PHP_EOL);
- print('Usage: php cli/jungen --option' . PHP_EOL);
- print('For example: php cli/jungen --help' . PHP_EOL);
- }
- ?>
|