generated from salesforcecli/plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f163da
commit 42531a0
Showing
4 changed files
with
85 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Command } from '@oclif/core'; | ||
import { cli } from 'cli-ux'; | ||
import { sortBy } from 'lodash'; | ||
import { Pull, Repos } from '../repos'; | ||
|
||
export default class Pulls extends Command { | ||
public static description = | ||
'List all pull requests for added repositories. Requires GH_TOKEN to be set in the environment.'; | ||
public static examples = ['<%= config.bin %> <%= command.id %>']; | ||
public static disableJsonFlag = true; | ||
|
||
public static flags = {}; | ||
|
||
public async run(): Promise<void> { | ||
const repos = await Repos.create(); | ||
const pulls = await repos.fetchPulls(); | ||
const columns = { | ||
repo: { header: 'Repo', get: (p: Pull): string => p.repo.split('/')[1] }, | ||
title: {}, | ||
url: { header: 'URL', get: (p: Pull): string => p.url }, | ||
}; | ||
const sorted = sortBy(Object.values(pulls), 'repo'); | ||
cli.table(sorted, columns, { title: 'Pull Requests' }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters