diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..935a517 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,4 @@ +### 0.1.0 + +* Initial release + diff --git a/README.md b/README.md index 213a580..6d3c46a 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ - [x] Add filtering to `find` command, to seach for tags or name - [ ] App port binding, i.e. phpmyadmin on 9000, phpcacheadmin on 9001 - [ ] Make use of a `~/.serverenvs` to override envs for instances +- [ ] Consider UDP? ## Examples diff --git a/src/Commands/FindCommand.php b/src/Commands/FindCommand.php index 37777ac..385d9be 100644 --- a/src/Commands/FindCommand.php +++ b/src/Commands/FindCommand.php @@ -15,12 +15,17 @@ class FindCommand extends Command protected function configure() { $this->addArgument("service", InputArgument::OPTIONAL, "Search query"); + $this->addOption("environment", "E", InputOption::VALUE_NONE, "Show the environment for the services"); + $this->addOption("ports", "P", InputOption::VALUE_NONE, "Show the ports for the services"); } protected function execute(InputInterface $input, OutputInterface $output) { $serviceRegistry = $this->getServiceRegistry(); + $printEnvs = $input->getOption("environment"); + $printPorts = $input->getOption("ports"); + $services = $serviceRegistry->findAllServices(); $query = $input->getArgument("service"); @@ -37,6 +42,17 @@ class FindCommand extends Command $tags = ""; } $output->writeln(sprintf(" %s: %s %s", $service['name'], $service['description']??"?", $tags)); + if ($printEnvs) { + foreach ($service['environment']??[] as $env=>$value) { + $output->writeln(sprintf(" %s=%s", $env, $value)); + + } + } + if ($printPorts) { + foreach ($service['ports']??[] as $port) { + $output->writeln(sprintf(" Port: %s (%s)", $port['port'], $port['info']??"Unknown")); + } + } } return self::SUCCESS;