@@ -21,28 +21,38 @@ import { config } from 'dotenv';
2121config ( ) ;
2222
2323// Configures the logger
24- import { LoggerConfig } from '../config/LoggerConfig' ;
24+ import { LoggerConfig } from '../../ config/LoggerConfig' ;
2525new LoggerConfig ( ) . configure ( ) ;
2626
2727figlet ( 'console' , ( error : any , data : any ) => {
2828 console . log ( chalk . blue ( data ) ) ;
29- console . log ( chalk . green ( '➜ ' ) + chalk . bold ( process . argv [ 2 ] ) ) ;
30- console . log ( ) ;
3129
3230 // Find all command files
33- glob ( path . join ( __dirname , '**/*Command.ts' ) , ( err : any , matches : string [ ] ) => {
31+ glob ( path . join ( __dirname , '../ **/*Command.ts' ) , ( err : any , matches : string [ ] ) => {
3432 if ( err ) {
3533 console . log ( err ) ;
3634 return ;
3735 }
36+
3837 const files = matches
3938 . filter ( m => m . indexOf ( '/lib' ) < 0 )
4039 . map ( m => ( {
4140 path : m ,
42- name : m . replace ( __dirname , '' ) . replace ( '.ts' , '' ) . substring ( 1 )
41+ name : m . replace ( __dirname . replace ( '/lib' , '' ) , '' ) . replace ( '.ts' , '' ) . substring ( 1 )
4342 } ) ) ;
4443
4544 const commands = files . map ( f => require ( f . path ) [ f . name ] ) ;
45+ const keys = commands . map ( c => c . command ) ;
46+ const key = process . argv [ 2 ] ;
47+
48+ if ( keys . indexOf ( key ) < 0 ) {
49+ console . log ( chalk . red ( '➜ ' ) + chalk . bold ( `Command ${ key } was not found!` ) ) ;
50+ console . log ( ) ;
51+ return ;
52+ }
53+
54+ console . log ( chalk . green ( '➜ ' ) + chalk . bold ( key ) ) ;
55+ console . log ( ) ;
4656
4757 commands . forEach ( ( c ) => {
4858 commander
0 commit comments