regit-cli
Version:
git helper cli
27 lines (21 loc) • 702 B
text/typescript
import { Command } from 'commander'
import { action as statusAction } from './status.js'
import {
listBranchStartingWith,
warmupGitRepo,
} from '../../services/gitHelpers.js'
import { branchPreview } from '../../const.js'
const action = async () => {
await warmupGitRepo()
const previewBranches = await listBranchStartingWith(branchPreview)
if (previewBranches.length === 0) {
throw new Error('No preview branches found')
}
for (let previewBranch of previewBranches) {
await statusAction(previewBranch.name.replace(branchPreview, ''))
console.log('\n')
}
}
export default (program: Command) => {
program.command('list').action(action)
}