package io.digdag.cli.client;

import io.digdag.cli.SystemExitException;
import io.digdag.client.DigdagClient;
import io.digdag.client.api.RestProject;
import io.digdag.client.api.RestProjectCollection;

import static io.digdag.cli.SystemExitException.systemExit;

public class ShowProjects
        extends ClientCommand
{
    @Override
    public void mainWithClientException()
            throws Exception
    {
        DigdagClient client = buildClient();

        RestProjectCollection projects = client.getProjects();
        for (RestProject proj : projects.getProjects()) {
            ln(" %s", proj.getName());
        }

        ln("");
        err.println("Use `" + programName + " workflows <project-name>` to show details.");
    }

    public SystemExitException usage(String error)
    {
        err.println("Usage: " + programName + " projects");
        showCommonOptions();
        return systemExit(error);
    }
}

@@ -595,12 +595,11 @@
 n(%22 
-%25s%22,
+%22 +
  pro
@@ -612,16 +612,473 @@
 ame());%0A
+            ln(%22  id: %22 + proj.getId());%0A            ln(%22  revision: %22 + proj.getRevision());%0A            ln(%22  archive type: %22 + proj.getArchiveType());%0A%0A            if (proj.getDeletedAt().isPresent()) %7B%0A                ln(%22  project deleted at:%22 + proj.getDeletedAt());%0A            %7D%0A            else %7B%0A                ln(%22  project created at: %22 + proj.getCreatedAt());%0A                ln(%22  revision updated at: %22 + proj.getUpdatedAt());%0A            %7D%0A
         

Output project details