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

Code should not be duplicated #48

Closed jmolivas closed 9 years ago

jmolivas commented 9 years ago

in src/terra/Command/Environment/EnvironmentEnable.php, line 33

The next 45 lines appear both in src/terra/Command/Environment/EnvironmentEnable.php:33 and src/terra/Command/Environment/EnvironmentRemove.php:34.

            'The name the environment to enable.'
        )
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        // If there are no apps, return
        if (count($this->getApplication()->getTerra()->getConfig()->get('apps')) == 0) {
            $output->writeln('<comment>There are no apps to remove!</comment>');
            $output->writeln('Use the command <info>terra app:add</info> to add your first app.');

in src/terra/Command/Environment/EnvironmentScale.php, line 56

The next 41 lines appear both in src/terra/Command/Environment/EnvironmentScale.php:56 and src/terra/Command/Environment/EnvironmentTest.php:50.

        $app_name = $input->getArgument('app_name');
        $environment_name = $input->getArgument('environment_name');
        $scale = $input->getArgument('scale');

        // If no name specified provide options
        if (empty($app_name)) {
            $question = new ChoiceQuestion(
                'Which app? ',
                array_keys($this->getApplication()->getTerra()->getConfig()->get('apps')),
                null
            );