From 3e56a35a3a026e3d3eb8e62c134e8a17ffe87501 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Fri, 12 Jun 2020 21:28:00 +0300 Subject: [PATCH] Exclude archived repositories by default. This closes #6. --- README.md | 1 + main.go | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/README.md b/README.md index a855b74..462f5b9 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ You can run `github2mr -help` to see available options, but in brief: * Or the reverse, ignoring all personal-repositories. * You can exclude repositories by name. * You can default to cloning repositories via HTTP, instead of SSH. +* By default all _archived_ repositories are excluded. ## Other Git Hosts diff --git a/main.go b/main.go index 412a76b..3c5b418 100644 --- a/main.go +++ b/main.go @@ -181,6 +181,7 @@ func main() { // // Parse flags // + archived := flag.Bool("archived", false, "Include archived repositories in the output?") api := flag.String("api", "https://api.github.com/", "The API end-point to use for the remote git-host.") authHeader := flag.Bool("auth-header-token", false, "Use an authorization-header including 'token' rather than 'bearer'.\nThis is required for gitbucket, and perhaps other systems.") exclude := flag.String("exclude", "", "Comma-separated list of repositories to exclude.") @@ -360,6 +361,15 @@ func main() { // for _, repo := range all { + // + // If the repository is archived then + // skip it, unless we're supposed to keep + // it. + // + if *repo.Archived && !*archived { + continue + } + // // The clone-type is configurable //