diff --git a/digdag-cli/src/main/java/io/digdag/cli/client/ShowWorkflow.java b/digdag-cli/src/main/java/io/digdag/cli/client/ShowWorkflow.java index bf971bad29..352dfa29d6 100644 --- a/digdag-cli/src/main/java/io/digdag/cli/client/ShowWorkflow.java +++ b/digdag-cli/src/main/java/io/digdag/cli/client/ShowWorkflow.java @@ -1,7 +1,10 @@ package io.digdag.cli.client; +import com.beust.jcommander.Parameter; +import com.google.common.base.Optional; import io.digdag.cli.SystemExitException; import io.digdag.client.DigdagClient; +import io.digdag.client.api.Id; import io.digdag.client.api.RestProject; import io.digdag.client.api.RestWorkflowDefinition; @@ -14,6 +17,12 @@ public class ShowWorkflow extends ClientCommand { + @Parameter(names = {"--last-id"}) + Id lastId = null; + + @Parameter(names = {"--count"}) + int count = 100; + @Override public void mainWithClientException() throws Exception @@ -36,6 +45,9 @@ public void mainWithClientException() public SystemExitException usage(String error) { err.println("Usage: " + programName + " workflows [project-name] [name]"); + err.println(" Options:"); + err.println(" --count number number of workflows"); + err.println(" --last-id id last id of workflow"); showCommonOptions(); return systemExit(error); } @@ -53,7 +65,7 @@ private void showWorkflows(String projName) } } else { - List defs = client.getWorkflowDefinitions().getWorkflows(); + List defs = client.getWorkflowDefinitions(Optional.fromNullable(lastId), count).getWorkflows(); String lastProjName = null; for (RestWorkflowDefinition def : defs) { if (!def.getProject().getName().equals(lastProjName)) { diff --git a/digdag-client/src/main/java/io/digdag/client/DigdagClient.java b/digdag-client/src/main/java/io/digdag/client/DigdagClient.java index f79f6ac435..9d7ad12d51 100644 --- a/digdag-client/src/main/java/io/digdag/client/DigdagClient.java +++ b/digdag-client/src/main/java/io/digdag/client/DigdagClient.java @@ -343,6 +343,14 @@ public RestWorkflowDefinitionCollection getWorkflowDefinitions(Optional last .queryParam("last_id", lastId.orNull())); } + public RestWorkflowDefinitionCollection getWorkflowDefinitions(Optional lastId, int count) + { + return doGet(RestWorkflowDefinitionCollection.class, + target("/api/workflows") + .queryParam("last_id", lastId.orNull()) + .queryParam("count", count)); + } + public RestWorkflowDefinitionCollection getWorkflowDefinitions(Id projId) { return doGet(RestWorkflowDefinitionCollection.class,