/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.prestosql.tests.product.launcher.cli;

import io.airlift.log.Logger;
import io.prestosql.tests.product.launcher.env.Environments;
import picocli.CommandLine.Option;

import static picocli.CommandLine.Command;

@Command(
        name = "down",
        description = "Shutdown environment created by launcher",
        usageHelpAutoWidth = true)
public final class EnvironmentDown
        implements Runnable
{
    private static final Logger log = Logger.get(EnvironmentDown.class);

    @Option(names = {"-h", "--help"}, usageHelp = true, description = "Show this help message and exit")
    public boolean usageHelpRequested;

    @Override
    public void run()
    {
        log.info("Pruning old environment(s)");
        Environments.pruneEnvironment();
    }
}

@@ -616,38 +616,127 @@
 ort 
-io.airlift.log.Logger
+picocli.CommandLine.ExitCode;%0Aimport picocli.CommandLine.Option;%0A%0Aimport java.util.concurrent.Callable
 ;%0A
+%0A
 import 
+static 
 io.p
@@ -787,45 +787,26 @@
 ents
-;%0Aimport picocli.CommandLine.Option;%0A
+.pruneEnvironment;
 %0Aimp
@@ -1038,92 +1038,27 @@
 nts 
-Runnable%0A%7B%0A    private static final Logger log = Logger.get(EnvironmentDown.class);%0A
+Callable%3CInteger%3E%0A%7B
 %0A   
@@ -1228,16 +1228,20 @@
 lic 
-void run
+Integer call
 ()%0A 
@@ -1257,31 +1257,14 @@
     
-log.info(%22Pruning old e
+pruneE
 nvir
@@ -1274,11 +1274,8 @@
 ent(
-s)%22
 );%0A 
@@ -1285,39 +1285,26 @@
     
-Environments.pruneEnvironment()
+return ExitCode.OK
 ;%0A  

Make EnvironmentDown callable