@@ -10,13 +10,15 @@ const filter = args.top ? 'top' : args.filter || 'all';
1010const amount = args . top || '' ;
1111const level = args . level || '' ;
1212const format = args . format || 'text' ;
13+ const theme = args . theme || '' ;
1314
1415const logHeader = ( header ) => console . log ( '\x1b[32m%s\x1b[0m' , header ) ;
1516const logDivider = ( ) => console . log ( '_________________________' ) ;
1617const logExampleParams = ( ) => {
1718 console . log ( "\x1b[32m%s\x1b[0m" , "Params example:" ) ;
1819 console . log ( "--top ${amount}" ) ;
19- console . log ( "--level ( junior | middle | senior )" ) ;
20+ console . log ( "--level ( basic | intermediate | advanced )" ) ;
21+ console . log ( "--theme ( closures | storage | es6 | classes | database ... and other 203 themes)" ) ;
2022 console . log ( "--format ( text | array | json )" ) ;
2123} ;
2224
@@ -29,10 +31,15 @@ const displayQuestions = (result, format) => {
2931 console . log ( result ) ;
3032 break ;
3133 default :
32- result . forEach ( ( { title, url } ) => {
34+ result . forEach ( ( { title, url, text , theme } ) => {
3335 console . log ( '' ) ;
3436 logHeader ( `Question: ${ title } ` ) ;
35- console . info ( `Answer: \x1b]8;;${ url } \x1b\\${ url } \x1b]8;;\x1b\\` ) ;
37+ if ( url ) {
38+ console . info ( `Answer: \x1b]8;;${ url } \x1b\\${ url } \x1b]8;;\x1b\\` ) ;
39+ } else {
40+ console . info ( `Answer: ${ text } ` ) ;
41+ }
42+ console . info ( `Hash: ${ theme . split ( ',' ) . map ( ( data ) => ` #${ data . trim ( ) . toLowerCase ( ) } ` ) } ` ) ;
3643 logDivider ( ) ;
3744 } ) ;
3845 }
@@ -46,10 +53,11 @@ const main = async () => {
4653 if ( filter ) console . log ( 'Filter -' , filter ) ;
4754 console . log ( '' ) ;
4855
49- const result = await interviewQuestion ( { filter, amount, level, format } ) ;
56+ const result = await interviewQuestion ( { filter, amount, level, format, theme } ) ;
5057 displayQuestions ( result , format ) ;
5158
5259 console . log ( '' ) ;
60+ console . log ( `Found ${ result . length } questions` ) ;
5361 logExampleParams ( ) ;
5462
5563 if ( verbose ) console . log ( 'Send questions' ) ;
0 commit comments