@@ -48,11 +48,14 @@ Unreleased commits: ${ pkg.isReleaseEnabled
4848 ? ansi . error ( " " + status . currentReleaseDistance + " " )
4949 : ansi . ok ( " RELEASED " ) )
5050 : "-" }
51+ ` . trim ( ) ) ;
5152
52- Branch status:
53- ${ await this . #createBranchStatus( pkg , status . branchStatus ) }
54- ` . trim ( ) ) ;
53+ // branch status
54+ console . log ( ) ;
55+ console . log ( "Branch status:" ) ;
56+ console . log ( await this . #createBranchStatus( pkg , status ) ) ;
5557
58+ // upstream links
5659 if ( upstream ) {
5760 console . log ( ) ;
5861
@@ -67,32 +70,33 @@ Clone wiki: ${ ansi.hl( upstream.wikiSshCloneUrl ) }
6770 ` . trim ( ) ) ;
6871 }
6972
70- const localizationStatus = pkg . localization . status ( ) ;
73+ // localization status
74+ const localizationStatus = this . #createLocalizationStatus( pkg ) ;
7175
72- if ( localizationStatus . data ) {
73- console . log ( "\nLocalization status:\n" ) ;
74-
75- for ( const [ poFilePath , isTranslated ] of Object . entries ( localizationStatus . data ) ) {
76- console . log ( isTranslated
77- ? " OK "
78- : ansi . error ( " FUZZY " ) , poFilePath ) ;
79- }
76+ if ( localizationStatus ) {
77+ console . log ( "" ) ;
78+ console . log ( "Localization status:\n" + localizationStatus ) ;
8079 }
8180 }
8281
8382 // private
84- async #createBranchStatus ( pkg , branchStatus ) {
83+ async #createBranchStatus ( pkg , status ) {
8584 const table = new Table ( {
8685 "ansi" : true ,
86+ "width" : 90 ,
8787 "columns" : {
8888 "branch" : {
8989 "title" : ansi . hl ( "BRANCH" ) ,
9090 "headerAlign" : "center" ,
9191 "headerValign" : "end" ,
92- "width" : 30 ,
92+ "format" : branch => {
93+ return `${ status . head . branch === branch
94+ ? "🔶"
95+ : " " } ${ branch } `;
96+ } ,
9397 } ,
94- "pushStatus " : {
95- "title" : ansi . hl ( "PUSH STATUS" ) ,
98+ "syncStatus " : {
99+ "title" : ansi . hl ( "SYNC STATUS" ) ,
96100 "headerAlign" : "center" ,
97101 "headerValign" : "end" ,
98102 "width" : 20 ,
@@ -105,14 +109,14 @@ Clone wiki: ${ ansi.hl( upstream.wikiSshCloneUrl ) }
105109 else {
106110 const text = [ ] ;
107111
108- if ( status . ahead ) {
109- text . push ( "push: " + ansi . error ( ` ${ status . ahead } ` ) ) ;
110- }
111-
112112 if ( status . behind ) {
113113 text . push ( "pull: " + ansi . error ( ` ${ status . behind } ` ) ) ;
114114 }
115115
116+ if ( status . ahead ) {
117+ text . push ( "push: " + ansi . error ( ` ${ status . ahead } ` ) ) ;
118+ }
119+
116120 return text . join ( ", " ) ;
117121 }
118122 }
@@ -131,7 +135,7 @@ Clone wiki: ${ ansi.hl( upstream.wikiSshCloneUrl ) }
131135 if ( pkg . isReleaseEnabled ) {
132136 if ( status . currentRelease ) {
133137 return `${ status . currentRelease . versionString } ${ status . releases . lastRelease . eq ( status . currentRelease )
134- ? " ✅️ "
138+ ? " 🚩 "
135139 : " " } `;
136140 }
137141 else {
@@ -166,19 +170,62 @@ Clone wiki: ${ ansi.hl( upstream.wikiSshCloneUrl ) }
166170 } ,
167171 } ) ;
168172
169- for ( const branch of Object . keys ( branchStatus ) . sort ( ) ) {
173+ for ( const branch of Object . keys ( status . branchStatus ) . sort ( ) ) {
170174 const res = await pkg . git . getCurrentRelease ( { "commitRef" : branch } ) ;
171175
172176 table . write ( {
173177 branch,
174- "pushStatus " : branchStatus [ branch ] ,
178+ "syncStatus " : status . branchStatus [ branch ] ,
175179 "currentRelease" : res . data ,
176180 "unreleasedCommits" : res . data ,
177181 } ) ;
178182 }
179183
180184 table . end ( ) ;
181185
182- return table . content + "✅️ - latest release" ;
186+ return `${ table . content . trim ( ) }
187+ 🔶 - current branch
188+ 🚩 - latest release
189+ ` . trim ( ) ;
190+ }
191+
192+ #createLocalizationStatus ( pkg ) {
193+ const localizationStatus = pkg . localization . status ( ) ,
194+ table = new Table ( {
195+ "ansi" : true ,
196+ "width" : 90 ,
197+ "columns" : {
198+ "isTranslated" : {
199+ "title" : ansi . hl ( "STATUS" ) ,
200+ "headerAlign" : "center" ,
201+ "headerValign" : "end" ,
202+ "width" : 13 ,
203+ "align" : "end" ,
204+ "format" : isTranslated => {
205+ return isTranslated
206+ ? " OK "
207+ : ansi . error ( " FUZZY " ) ;
208+ } ,
209+ } ,
210+ "poFilePath" : {
211+ "title" : ansi . hl ( "PATH" ) ,
212+ "headerAlign" : "center" ,
213+ "headerValign" : "end" ,
214+ } ,
215+ } ,
216+ } ) ;
217+
218+ if ( localizationStatus . data ) {
219+ for ( const [ poFilePath , isTranslated ] of Object . entries ( localizationStatus . data ) ) {
220+ table . write ( {
221+ poFilePath,
222+ isTranslated,
223+ } ) ;
224+ }
225+ }
226+
227+ table . end ( ) ;
228+
229+ return table . content ;
183230 }
184231}
0 commit comments