Skip to content

Commit e2c5544

Browse files
committed
Use --long-format flags. Reformat with Prettier
1 parent b8558ff commit e2c5544

File tree

1 file changed

+65
-18
lines changed

1 file changed

+65
-18
lines changed

bin/github-default-branch

Lines changed: 65 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,70 @@
11
#!/usr/bin/env node
22
(async function () {
3-
const { argv } = require("yargs").options({
4-
pat: {type: "string", description: "GitHub API Token"},
5-
repo: {type: "string", description: "The repo to update (format: user/repo"},
6-
user: {type: "string", description: "Update all repos owned by the provided user (example: my-user)"},
7-
org: {type: "string", description: "Update all repos in the provided org (example: my-org-name)"},
8-
keepOld: {type: "boolean", default: false, description: "Keep the old branch rather than deleting it"},
9-
dryRun: {type: "boolean", default: false, description: "Output log messages only. Do not make any changes"},
10-
listReposOnly: {type: "boolean", default: false, description: "List repos that would be affected, then exit"},
11-
skipForks: {type: "boolean", default: false, description: "Skips forked repositories"},
12-
old: {type: "string", default: "master", description: "The name of the branch to rename"},
13-
new: {type: "string", default: "main", description: "The new branch name"},
14-
confirm: {type: "boolean", default: false, description: "Run without prompting for confirmation"},
15-
}).example([
16-
["$0 --pat <token> --repo user/repo", "Rename master to main"],
17-
["$0 --pat <token> --repo user/repo --old dev --new develop", "Rename dev to develop"],
18-
["$0 --pat <token> --org my-org-name", "Rename all repos owned by an org"],
19-
["$0 --pat <token> --user my-user", "Rename all repos owned by a user"],
20-
]);
3+
const { argv } = require("yargs")
4+
.options({
5+
pat: { type: "string", description: "GitHub API Token" },
6+
repo: {
7+
type: "string",
8+
description: "The repo to update (format: user/repo)",
9+
},
10+
user: {
11+
type: "string",
12+
description:
13+
"Update all repos owned by the provided user (example: my-user)",
14+
},
15+
org: {
16+
type: "string",
17+
description:
18+
"Update all repos in the provided org (example: my-org-name)",
19+
},
20+
"keep-old": {
21+
type: "boolean",
22+
default: false,
23+
description: "Keep the old branch rather than deleting it",
24+
},
25+
"dry-run": {
26+
type: "boolean",
27+
default: false,
28+
description: "Output log messages only. Do not make any changes",
29+
},
30+
"list-repos-only": {
31+
type: "boolean",
32+
default: false,
33+
description: "List repos that would be affected, then exit",
34+
},
35+
"skip-forks": {
36+
type: "boolean",
37+
default: false,
38+
description: "Skips forked repositories",
39+
},
40+
old: {
41+
type: "string",
42+
default: "master",
43+
description: "The name of the branch to rename",
44+
},
45+
new: {
46+
type: "string",
47+
default: "main",
48+
description: "The new branch name",
49+
},
50+
confirm: {
51+
type: "boolean",
52+
default: false,
53+
description: "Run without prompting for confirmation",
54+
},
55+
})
56+
.example([
57+
["$0 --pat <token> --repo user/repo", "Rename master to main"],
58+
[
59+
"$0 --pat <token> --repo user/repo --old dev --new develop",
60+
"Rename dev to develop",
61+
],
62+
[
63+
"$0 --pat <token> --org my-org-name",
64+
"Rename all repos owned by an org",
65+
],
66+
["$0 --pat <token> --user my-user", "Rename all repos owned by a user"],
67+
]);
2168

2269
const isDryRun = !!argv.dryRun;
2370

0 commit comments

Comments
 (0)