File tree Expand file tree Collapse file tree 2 files changed +21
-10
lines changed
Expand file tree Collapse file tree 2 files changed +21
-10
lines changed Original file line number Diff line number Diff line change @@ -26,25 +26,36 @@ for ( const line of lines ) {
2626 if ( line . length === 0 ) {
2727 continue ;
2828 }
29-
29+
3030 if ( lines . indexOf ( line ) === 0 ) {
3131 columnIndexes [ 0 ] = line . indexOf ( 'Current' ) ;
3232 columnIndexes [ 1 ] = line . indexOf ( 'Wanted' ) + 3 ;
3333 columnIndexes [ 2 ] = line . indexOf ( 'Latest' ) + 6 ;
3434 columnIndexes [ 3 ] = line . indexOf ( 'Location' ) + 9 ;
3535 }
36-
37- let modifiedLine = line ;
38-
36+
37+ let modifiedLine = '' ;
38+
3939 if ( columnIndexes [ 0 ] >= 0 ) {
40- for ( const columnIndex of columnIndexes ) {
41- modifiedLine = modifiedLine . substring ( 0 , columnIndex ) + ' | ' + modifiedLine . substring ( columnIndex , modifiedLine . length ) ;
40+ const stringParts = line . split ( / ( \s + ) / ) ;
41+
42+ modifiedLine += '| ' ;
43+
44+ for ( let part of stringParts ) {
45+ if ( part . match ( / \s + / ) ) {
46+ modifiedLine += ' | ' ;
47+ } else {
48+ modifiedLine += part ;
49+ }
4250 }
43- console . log ( '| ' + modifiedLine + ' |' ) ;
51+
52+ modifiedLine += ' |' ;
53+
54+ console . log ( modifiedLine ) ;
4455 } else {
4556 console . log ( modifiedLine ) ;
4657 }
47-
58+
4859 if ( lines . indexOf ( line ) === 0 ) {
4960 console . log ( '| --- | --- | --- | --- | --- |' ) ;
5061 }
Original file line number Diff line number Diff line change 2525 },
2626 "devDependencies" : {
2727 "@types/inquirer" : " ^8.1.3" ,
28- "@types/node" : " ^16.11.11 " ,
28+ "@types/node" : " ^16.11.12 " ,
2929 "@types/shelljs" : " ^0.8.9" ,
3030 "@types/yargs" : " ^17.0.4" ,
3131 "ts-node" : " ^10.3.0" ,
32- "typescript" : " ^4.5.2 "
32+ "typescript" : " ^4.5.3 "
3333 },
3434 "git repository" : " https://github.com/open-template-hub/open-template-hub-server-generator" ,
3535 "repository" : {
You can’t perform that action at this time.
0 commit comments