Skip to content
Permalink
Browse files
224: Add --no-draft flag to git pr list
Reviewed-by: rwestberg
  • Loading branch information
edvbld committed Jan 13, 2020
1 parent 9c67b6d commit 72c93f083e5803aedca5d71450c34e5b5fd4370c
Showing 1 changed file with 10 additions and 1 deletion.
@@ -492,6 +492,10 @@ public static void main(String[] args) throws IOException, InterruptedException
.fullname("no-decoration")
.helptext("Hide any decorations when listing PRs")
.optional(),
Switch.shortcut("")
.fullname("no-draft")
.helptext("Hide all pull requests in draft state")
.optional(),
Switch.shortcut("")
.fullname("ignore-workspace")
.helptext("Ignore local changes in worktree and staging area when creating pull request")
@@ -535,7 +539,7 @@ public static void main(String[] args) throws IOException, InterruptedException

var inputs = List.of(
Input.position(0)
.describe("list|fetch|show|checkout|apply|integrate|approve|create|close|update|test")
.describe("list|fetch|show|checkout|apply|integrate|approve|create|close|update|test|status")
.singular()
.optional(),
Input.position(1)
@@ -1096,6 +1100,7 @@ public static void main(String[] args) throws IOException, InterruptedException
var issues = new ArrayList<String>();
var branches = new ArrayList<String>();
var statuses = new ArrayList<String>();
var noDraft = getSwitch("no-draft", "list", arguments);

var authorsOption = getOption("authors", "list", arguments);
var filterAuthors = authorsOption == null ?
@@ -1141,6 +1146,10 @@ public static void main(String[] args) throws IOException, InterruptedException
}

for (var pr : prs) {
if (pr.isDraft() && noDraft) {
continue;
}

var prAuthor = pr.author().userName();
if (!filterAuthors.isEmpty() && !filterAuthors.contains(prAuthor)) {
continue;

0 comments on commit 72c93f0

Please sign in to comment.