-
Notifications
You must be signed in to change notification settings - Fork 1
/
cli.js
executable file
·22 lines (21 loc) · 774 Bytes
/
cli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env node
import { getLastMergedPrNumber, getLastMergedPrRef } from './index.js'
import yargs from 'yargs'
import { hideBin } from 'yargs/helpers'
const argv = yargs(hideBin(process.argv))
.usage('usage: $0 <command> [options]')
.option('owner', {
describe: 'The GitHub owner.'
})
.option('repo', {
describe: 'The GitHub repo.'
})
.demandOption(['owner', 'repo'], 'Must provide a GitHub repo and owner')
.command('lastPrNumber', 'Get the last merged PR number.', () => {}, async (argv) =>
console.log(await getLastMergedPrNumber(argv.owner, argv.repo))
)
.command('lastPrRef', 'Get the last merged PR ref branch name.', () => {}, async (argv) =>
console.log(await getLastMergedPrRef(argv.owner, argv.repo))
)
.help()
.argv