| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -51,9 +51,16 @@ def gh(*args): | |||
| 51 | 51 | def fetch_items(): | |
| 52 | 52 | owner, name = REPO.split("/", 1) | |
| 53 | 53 | out = gh( | |
| 54 | - "api", "graphql", | ||
| 55 | - "-f", f"query={QUERY}", | ||
| 56 | - "-F", f"owner={owner}", "-F", f"name={name}", "-f", f"label={LABEL}", | ||
| 54 | + "api", | ||
| 55 | + "graphql", | ||
| 56 | + "-f", | ||
| 57 | + f"query={QUERY}", | ||
| 58 | + "-F", | ||
| 59 | + f"owner={owner}", | ||
| 60 | + "-F", | ||
| 61 | + f"name={name}", | ||
| 62 | + "-f", | ||
| 63 | + f"label={LABEL}", | ||
| 57 | 64 | ) | |
| 58 | 65 | nodes = json.loads(out)["data"]["repository"]["issues"]["nodes"] | |
| 59 | 66 | items = [] | |
@@ -91,26 +98,28 @@ def splice(body, block): | |||
| 91 | 98 | lines = body.split("\n") | |
| 92 | 99 | for i, line in enumerate(lines): | |
| 93 | 100 | if line.strip() == HEADING: | |
| 94 | - lines[i + 1:i + 1] = ["", section] | ||
| 101 | + lines[i + 1 : i + 1] = ["", section] | ||
| 95 | 102 | return "\n".join(lines) | |
| 96 | 103 | raise SystemExit(f"Heading not found in issue #{MASTER}: {HEADING}") | |
| 97 | 104 | ||
| 98 | 105 | ||
| 99 | 106 | def main(): | |
| 100 | - body = gh("issue", "view", str(MASTER), "--repo", REPO, | ||
| 101 | - "--json", "body", "-q", ".body") | ||
| 107 | + body = gh( | ||
| 108 | + "issue", "view", str(MASTER), "--repo", REPO, "--json", "body", "-q", ".body" | ||
| 109 | + ) | ||
| 102 | 110 | old = body.replace("\r\n", "\n").rstrip("\n") | |
| 103 | 111 | new = splice(body, render(fetch_items())).rstrip("\n") | |
| 104 | 112 | ||
| 105 | 113 | if new == old: | |
| 106 | 114 | print("Master issue already up to date.") | |
| 107 | 115 | return | |
| 108 | - with tempfile.NamedTemporaryFile("w", suffix=".md", delete=False, | ||
| 109 | - encoding="utf-8") as f: | ||
| 116 | + with tempfile.NamedTemporaryFile( | ||
| 117 | + "w", suffix=".md", delete=False, encoding="utf-8" | ||
| 118 | + ) as f: | ||
| 110 | 119 | f.write(new + "\n") | |
| 111 | 120 | gh("issue", "edit", str(MASTER), "--repo", REPO, "--body-file", f.name) | |
| 112 | 121 | print(f"Updated issue #{MASTER}.") | |
| 113 | 122 | ||
| 114 | 123 | ||
| 115 | 124 | if __name__ == "__main__": | |
| 116 | - sys.exit(main()) | ||
| 125 | + sys.exit(main()) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments