terra-ops / terra-cli

The Terra Command Line Interface
http://terra.readthedocs.org
GNU General Public License v2.0
48 stars 17 forks source link

ChoiceQuestion options break in certain environments #55

Closed jonpugh closed 8 years ago

jonpugh commented 8 years ago

On my laptop, ubuntu-gnome 14.10 php v 5.5.12-2ubuntu4.4, terra environment:add works well, asking you which app to choose.

In the vagrant box, ubuntu trusty64 (12.04) it fails!

This has also been reported as happening in OSX.

In trusty 64: php 5.5.9-1ubuntu4.11

vagrant@terra:~$ terra e:a
Which app? 
  [0] demo
 > demo
PHP Notice:  Undefined index: demo in /usr/share/terra/vendor/symfony/console/Question/ChoiceQuestion.php on line 165

  [Exception]         
  App '' not found.'  

cc:@EclipseGc @jmolivas

EclipseGc commented 8 years ago

I went to the effort of fixing this for myself in the enable command, example here: https://gist.github.com/EclipseGc/984d9985f47a5319d364

We should probably find a better place for that logic than replicating it over and over in the various commands.

jonpugh commented 8 years ago

I actually already did...

I created methods in the Terra Command class for getApp() and getEnvironment().

I just didn't get around to actually implementing it in all the commands.

See EnvironmentTest.php or EnvironmentDeploy.php:

        // Ask for an app and environment.
        $this->getApp($input, $output);
        $this->getEnvironment($input, $output);

I'll go ahead and do this now.

jonpugh commented 8 years ago

Fixed in e4067a45e280f9dad8a1834487d51c05572cc2df