@@ -4,6 +4,7 @@ var sprintf = require('sprintf-js').sprintf;
4
4
var _ = require ( 'underscore' ) ;
5
5
6
6
var chalk = require ( '../chalk' ) ;
7
+ var icon = require ( '../icon' ) ;
7
8
var log = require ( '../log' ) ;
8
9
var core = require ( '../core' ) ;
9
10
var session = require ( '../session' ) ;
@@ -79,18 +80,12 @@ function showProgress(problems) {
79
80
printLine ( 'Hard' , stats . hard . ac , stats . hard . all ) ;
80
81
}
81
82
82
- const CHARS = {
83
- ac : h . isWindows ( ) ? 'O ' : '▣ ' ,
84
- notac : h . isWindows ( ) ? 'X ' : '▤ ' ,
85
- none : h . isWindows ( ) ? 'o ' : '⬚ ' ,
86
- } ;
87
-
88
83
function showGraph ( problems ) {
89
84
const ICONS = {
90
- ac : chalk . green ( CHARS . ac ) ,
91
- notac : chalk . red ( CHARS . notac ) ,
92
- none : chalk . gray ( CHARS . none ) ,
93
- empty : ' '
85
+ ac : chalk . green ( icon . ac ) ,
86
+ notac : chalk . red ( icon . notac ) ,
87
+ none : chalk . gray ( icon . none ) ,
88
+ empty : icon . empty
94
89
} ;
95
90
96
91
// row header is 4 bytes
@@ -101,9 +96,9 @@ function showGraph(problems) {
101
96
if ( groups > 5 ) groups = 5 ;
102
97
103
98
const header = _ . range ( groups )
104
- . map ( x => sprintf ( '%5d %18d' , x * 10 + 1 , x * 10 + 10 ) )
99
+ . map ( x => sprintf ( '%4d %18d' , x * 10 + 1 , x * 10 + 10 ) )
105
100
. join ( '' ) ;
106
- log . info ( ' ' + header ) ;
101
+ log . info ( ' ' + header ) ;
107
102
108
103
const graph = [ ] ;
109
104
for ( let problem of problems )
@@ -112,33 +107,33 @@ function showGraph(problems) {
112
107
let line = [ sprintf ( ' %03d' , 0 ) ] ;
113
108
for ( let i = 1 , n = graph . length ; i <= n ; ++ i ) {
114
109
// padding before group
115
- if ( i % 10 === 1 ) line . push ( ' ' ) ;
110
+ if ( i % 10 === 1 ) line . push ( ' ' ) ;
116
111
117
112
line . push ( graph [ i ] || ICONS . empty ) ;
118
113
119
114
// time to start new row
120
115
if ( i % ( 10 * groups ) === 0 || i === n ) {
121
- log . info ( line . join ( '' ) ) ;
116
+ log . info ( line . join ( ' ' ) ) ;
122
117
line = [ sprintf ( ' %03d' , i ) ] ;
123
118
}
124
119
}
125
120
126
121
log . info ( ) ;
127
122
log . printf ( '%7s%s%3s%s%3s%s' ,
128
- ' ' , ICONS . ac + chalk . green ( ' Accepted' ) ,
129
- ' ' , ICONS . notac + chalk . red ( ' Not Accepted' ) ,
130
- ' ' , ICONS . none + ' Remaining' ) ;
123
+ ' ' , ICONS . ac + chalk . green ( ' Accepted' ) ,
124
+ ' ' , ICONS . notac + chalk . red ( ' Not Accepted' ) ,
125
+ ' ' , ICONS . none + ' Remaining' ) ;
131
126
}
132
127
133
128
function showCal ( ) {
134
129
const MONTHS = [ 'Jan' , 'Feb' , 'Mar' , 'Apr' , 'May' , 'Jun' , 'Jul' , 'Aug' , 'Sep' , 'Oct' , 'Nov' , 'Dec' ] ;
135
130
const WEEKDAYS = [ 'Sun' , 'Mon' , 'Tue' , 'Wed' , 'Thu' , 'Fri' , 'Sat' ] ;
136
131
const ICONS = [
137
- CHARS . none ,
138
- chalk . sprint ( CHARS . ac , '#ffffcc' ) ,
139
- chalk . sprint ( CHARS . ac , '#ccff66' ) ,
140
- chalk . sprint ( CHARS . ac , '#66cc33' ) ,
141
- chalk . sprint ( CHARS . ac , '#00ff00' )
132
+ icon . none ,
133
+ chalk . white ( icon . ac ) ,
134
+ chalk . green ( icon . ac ) ,
135
+ chalk . yellow ( icon . ac ) ,
136
+ chalk . red ( icon . ac )
142
137
] ;
143
138
144
139
const N_MONTHS = 12 ;
@@ -192,15 +187,15 @@ function showCal() {
192
187
if ( idx === 0 && d . month ( ) % 2 ) icon = chalk . gray ( icon ) ;
193
188
line . push ( icon ) ;
194
189
}
195
- log . info ( line . join ( '' ) ) ;
190
+ log . info ( line . join ( ' ' ) ) ;
196
191
}
197
192
198
193
log . info ( ) ;
199
- log . printf ( '%7s %s%3s%s%3s%s%3s%s' ,
200
- ' ' , ICONS [ 1 ] + ' 1~5' ,
201
- ' ' , ICONS [ 2 ] + ' 6~10' ,
202
- ' ' , ICONS [ 3 ] + ' 11~15' ,
203
- ' ' , ICONS [ 4 ] + ' 16+' ) ;
194
+ log . printf ( '%8s %s%3s%s%3s%s%3s%s' ,
195
+ ' ' , ICONS [ 1 ] + ' 1~5' ,
196
+ ' ' , ICONS [ 2 ] + ' 6~10' ,
197
+ ' ' , ICONS [ 3 ] + ' 11~15' ,
198
+ ' ' , ICONS [ 4 ] + ' 16+' ) ;
204
199
}
205
200
206
201
cmd . handler = function ( argv ) {
0 commit comments