| @@ 24-53 (lines=30) @@ | ||
| 21 | * @brief Returns the tail of the server's log file. |
|
| 22 | * @nosubgrouping |
|
| 23 | */ |
|
| 24 | class LogCommand extends AbstractCommand { |
|
| 25 | ||
| 26 | ||
| 27 | /** |
|
| 28 | * @brief Configures the command. |
|
| 29 | */ |
|
| 30 | protected function configure() { |
|
| 31 | $this->setName("log"); |
|
| 32 | $this->setDescription("Returns the tail of the server's log file"); |
|
| 33 | ||
| 34 | // General options. |
|
| 35 | $this->addOption("bytes", |
|
| 36 | NULL, |
|
| 37 | InputOption::VALUE_OPTIONAL, |
|
| 38 | "How many bytes to return from the end of the log file", |
|
| 39 | 1000); |
|
| 40 | } |
|
| 41 | ||
| 42 | ||
| 43 | /** |
|
| 44 | * @brief Executes the command. |
|
| 45 | */ |
|
| 46 | protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 47 | $bytes = (int)$input->getOption('bytes'); |
|
| 48 | ||
| 49 | $couch = $this->getConnection(); |
|
| 50 | $couch->getLogTail($bytes); |
|
| 51 | } |
|
| 52 | ||
| 53 | } |
|
| @@ 23-52 (lines=30) @@ | ||
| 20 | * @brief Returns a list of generated UUIDs. |
|
| 21 | * @nosubgrouping |
|
| 22 | */ |
|
| 23 | class UuidsCommand extends AbstractCommand { |
|
| 24 | ||
| 25 | ||
| 26 | /** |
|
| 27 | * @brief Configures the command. |
|
| 28 | */ |
|
| 29 | protected function configure() { |
|
| 30 | $this->setName("uuids"); |
|
| 31 | $this->setDescription("Returns a list of generated UUIDs"); |
|
| 32 | ||
| 33 | // General options. |
|
| 34 | $this->addOption("count", |
|
| 35 | NULL, |
|
| 36 | InputOption::VALUE_OPTIONAL, |
|
| 37 | "Requested UUIDs number", |
|
| 38 | 1); |
|
| 39 | } |
|
| 40 | ||
| 41 | ||
| 42 | /** |
|
| 43 | * @brief Executes the command. |
|
| 44 | */ |
|
| 45 | protected function execute(InputInterface $input, OutputInterface $output) { |
|
| 46 | $count = (int)$input->getOption('count'); |
|
| 47 | ||
| 48 | $couch = $this->getConnection(); |
|
| 49 | $output->writeln($couch->getUuids($count)); |
|
| 50 | } |
|
| 51 | ||
| 52 | } |
|