1818use Continuous \DeployAgent \Resource \FileSystem \Directory ;
1919use Continuous \DeployAgent \Task \TaskManager ;
2020use League \Flysystem \Filesystem ;
21+ use Symfony \Component \Console \Helper \Table ;
22+ use Symfony \Component \Console \Output \ConsoleOutput ;
2123use Zend \Config \Config ;
2224use Zend \Console \ColorInterface ;
2325use Zend \Console \Console ;
@@ -38,8 +40,37 @@ class ApplicationController extends AbstractConsoleController
3840 public function listAction ()
3941 {
4042 $ model = new ConsoleModel ();
43+
44+ /** @var \Continuous\DeployAgent\Application\ApplicationManager $applicationManager */
45+ $ applicationManager = $ this ->getServiceLocator ()
46+ ->get ('application/application-manager ' );
47+
48+ $ applications = $ applicationManager ->findAll ();
4149
42- $ model ->setResult ('No application found ' . PHP_EOL );
50+ $ output = new ConsoleOutput ();
51+
52+ if (empty ($ applications )) {
53+ $ model ->setResult ('No application found ' . PHP_EOL );
54+ } else {
55+ $ table = new Table ($ output );
56+ $ table ->setHeaders ([]);
57+ foreach ($ applications as $ application ) {
58+ /** @var Application $application */
59+ /** @var Continuousphp $provider */
60+ $ provider = $ application ->getProvider ();
61+ $ table ->setHeaders (['name ' , 'path ' , 'provider ' , 'source ' ]);
62+ $ table ->addRow ([
63+ $ application ->getName (),
64+ $ application ->getPath (),
65+ 'continuousphp ' ,
66+ $ provider ?
67+ $ provider ->getRepositoryProvider ()
68+ . '/ ' . $ provider ->getRepository ()
69+ . ':: ' . $ provider ->getReference () : ''
70+ ]);
71+ }
72+ $ table ->render ();
73+ }
4374
4475 return $ model ;
4576 }
0 commit comments