/*******************************************************************************
 * Copyright (c) 2012-2014 Codenvy, S.A.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Codenvy, S.A. - initial API and implementation
 *******************************************************************************/
package com.codenvy.cli.command.builtin;

import com.codenvy.cli.command.builtin.model.DefaultUserProject;
import com.codenvy.cli.command.builtin.model.DefaultUserWorkspace;
import com.codenvy.cli.command.builtin.model.UserProject;
import com.codenvy.cli.command.builtin.model.UserWorkspace;
import com.codenvy.cli.command.builtin.util.AsciiArray;
import com.codenvy.client.Codenvy;
import com.codenvy.client.Request;
import com.codenvy.client.WorkspaceClient;
import com.codenvy.client.model.Project;
import com.codenvy.client.model.Workspace;
import com.codenvy.client.model.WorkspaceRef;

import org.apache.karaf.shell.commands.Command;
import org.fusesource.jansi.Ansi;

import java.util.ArrayList;
import java.util.List;

/**
 * List command.
 * This command will list all projects used in Codenvy.
 * @author Florent Benoit
 */
@Command(scope = "codenvy", name = "list", description = "List all the projects from Codenvy System")
public class ListCommand extends AbsCommand {

    /**
     * Prints the current projects per workspace
     */
    protected Object doExecute() {
        Codenvy current = checkLoggedIn();

        Ansi buffer = Ansi.ansi();


       List<UserProject> projects = getProjects(current);
       if (projects.isEmpty()) {
            buffer.a("No projects");
           session.getConsole().println(buffer.toString());
           return null;
       }

        // Titles
        List<String> ids = new ArrayList<>();
        List<String> workspaces = new ArrayList<>();
        List<String> projectNames = new ArrayList<>();

        for (UserProject project : projects) {
            ids.add(project.shortId());
            workspaces.add(project.getWorkspace().name());
            projectNames.add(project.name());
        }

        // Ascii array
        AsciiArray asciiArray = new AsciiArray().withColumns(ids, workspaces, projectNames).withTitle("ID", "Workspace", "Project");
        session.getConsole().println(asciiArray.toAscii());

        return null;
    }


}

@@ -1682,24 +1682,25 @@
 );%0A%0A%0A       
+ 
 List%3CUserPro
@@ -1738,16 +1738,17 @@
 rrent);%0A
+ 
        i
@@ -1805,24 +1805,25 @@
 projects%22);%0A
+ 
            s
@@ -1873,32 +1873,33 @@
 ());%0A           
+ 
 return null;%0A   
@@ -1891,24 +1891,25 @@
 eturn null;%0A
+ 
        %7D%0A%0A  

Fix indent