@@ -6,29 +6,39 @@ export default class extends Command {
66
77 // static
88 static cli ( ) {
9- return { } ;
9+ return {
10+ "options" : {
11+ "branches" : {
12+ "short" : "b" ,
13+ "description" : "show branches only" ,
14+ "default" : false ,
15+ "schema" : { "type" : "boolean" } ,
16+ } ,
17+ } ,
18+ } ;
1019 }
1120
1221 // public
1322 async run ( ) {
1423 const pkg = this . _findGitRoot ( ) ;
1524 if ( ! pkg ) return result ( [ 500 , "Unable to find git root" ] ) ;
1625
17- const git = pkg . git ;
18-
1926 var res ;
2027
21- res = await git . getStatus ( {
28+ res = await pkg . git . getStatus ( {
2229 "branchStatus" : true ,
2330 } ) ;
2431 if ( ! res . ok ) return res ;
2532 const status = res . data ;
2633
27- const upstream = git . upstream ;
28-
29- const config = pkg . config ;
34+ // branches
35+ if ( process . cli . options . branches ) {
36+ console . log ( await this . #createBranchStatus( pkg , status ) ) ;
37+ }
38+ else {
39+ const config = pkg . config ;
3040
31- console . log ( `
41+ console . log ( `
3242Package name: ${ ansi . hl ( config ?. name || "-" ) }
3343Releasable: ${ pkg . isReleaseEnabled
3444 ? ansi . ok ( " RELEASABLE " )
@@ -53,16 +63,18 @@ Unreleased commits: ${ pkg.isReleaseEnabled
5363 : "-" }
5464` . trim ( ) ) ;
5565
56- // branch status
57- console . log ( ) ;
58- console . log ( "Branch status:" ) ;
59- console . log ( await this . #createBranchStatus( pkg , status ) ) ;
60-
61- // upstream links
62- if ( upstream ) {
66+ // branch status
6367 console . log ( ) ;
68+ console . log ( "Branch status:" ) ;
69+ console . log ( await this . #createBranchStatus( pkg , status ) ) ;
6470
65- console . log ( `
71+ // upstream links
72+ const upstream = pkg . git . upstream ;
73+
74+ if ( upstream ) {
75+ console . log ( ) ;
76+
77+ console . log ( `
6678Home: ${ ansi . hl ( upstream . homeUrl ) }
6779Issues: ${ ansi . hl ( upstream . issuesUrl ) }
6880Wiki: ${ ansi . hl ( upstream . wikiUrl ) }
@@ -71,14 +83,15 @@ Docs: ${ ansi.hl( pkg.docsUrl || "-" ) }
7183Clone: ${ ansi . hl ( upstream . sshCloneUrl ) }
7284Clone wiki: ${ ansi . hl ( upstream . wikiSshCloneUrl ) }
7385 ` . trim ( ) ) ;
74- }
86+ }
7587
76- // localization status
77- const localizationStatus = this . #createLocalizationStatus( pkg ) ;
88+ // localization status
89+ const localizationStatus = this . #createLocalizationStatus( pkg ) ;
7890
79- if ( localizationStatus ) {
80- console . log ( "" ) ;
81- console . log ( "Localization status:\n" + localizationStatus ) ;
91+ if ( localizationStatus ) {
92+ console . log ( "" ) ;
93+ console . log ( "Localization status:\n" + localizationStatus ) ;
94+ }
8295 }
8396 }
8497
0 commit comments