File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ This command uses external config file `env.js` file of the next shape
4242// github-prs/env.js
4343module .exports = {
4444 authToken: ' auth_token_goes_here' , // your GH auth token
45- creator: ' dev99prblems ' , // your GH user name aka author
45+ creator: ' dev99problems ' , // your GH user name aka author
4646 projects: {
4747 work: {
4848 owner: ' apple' , // your organization name goes here
Original file line number Diff line number Diff line change @@ -56,15 +56,15 @@ const getSectionProjectsPrs = async (owner, reposList) => {
5656 try {
5757 const { projects } = ENV
5858 const keys = Object . keys ;
59-
59+
6060 for ( const section of keys ( projects ) ) {
6161 const { owner, repos } = projects [ section ]
6262
6363 const allPRs = await getSectionProjectsPrs ( owner , repos )
6464 const anyPrInSection = ! ! keys ( allPRs ) ?. length
6565
6666 anyPrInSection && displaySectionName ( section )
67- displayPrs ( allPRs )
67+ displayPrs ( allPRs , owner )
6868 }
6969 } catch ( err ) {
7070 console . error ( err )
Original file line number Diff line number Diff line change @@ -22,25 +22,28 @@ const prepareForOutput = (pr, idx) => {
2222 return row
2323}
2424
25- const displayPrs = allPRs => {
25+ const displayPrs = ( allPRs , owner ) => {
2626 Object . keys ( allPRs ) . forEach ( repoName => {
2727 const repoPRs = allPRs [ repoName ]
28- const repositoryName = `${ FgBlue } ${ repoName } :\n`
29- console . log ( repositoryName )
28+ const projectName = `@${ owner } /${ repoName } `
29+ const repositoryName = `${ FgBlue } ${ projectName } :\n`
30+ process . stdout . write ( repositoryName )
3031
3132 const prsList = repoPRs . map ( prepareForOutput ) . join ( '' )
3233
33- console . log ( prsList )
34+ process . stdout . write ( prsList )
3435 } )
3536}
3637
3738const displaySectionName = section => {
3839 const colorMap = {
3940 work : FgRed ,
4041 personal : FgGreen ,
42+ default : FgCyan ,
4143 }
42-
43- console . log ( colorMap [ section ] + section . toUpperCase ( ) + ':' )
44+ const color = colorMap ?. [ section ] ?? colorMap . default ;
45+
46+ process . stdout . write ( color + section . toUpperCase ( ) + ':' + '\n' )
4447}
4548
4649exports . displayPrs = displayPrs
You can’t perform that action at this time.
0 commit comments