Skip to content

Commit 0711a21

Browse files
Merge pull request #3 from 6RiverSystems/fix/help-text
fix: make help and arguments actually useful
2 parents 0bf6820 + 7362a23 commit 0711a21

File tree

3 files changed

+67
-13
lines changed

3 files changed

+67
-13
lines changed

bin/github-default-branch

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
#!/usr/bin/env node
22
(async function () {
3-
const { argv } = require("yargs");
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+
]);
421

522
const isDryRun = !!argv.dryRun;
623

package-lock.json

+48-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@octokit/rest": "^18.0.0",
2121
"prompt-confirm": "^2.0.4",
2222
"string.prototype.replaceall": "^1.0.3",
23-
"yargs": "^15.3.1"
23+
"yargs": "^15.4.0"
2424
},
2525
"bin": {
2626
"github-default-branch": "./bin/github-default-branch"

0 commit comments

Comments
 (0)