@@ -53,22 +53,14 @@ class Alacritty {
5353 themes : {
5454 type : "Themes directory" ,
5555 path : `${ this . basePath } /themes` ,
56- exists : ( ) => {
57- fs . existsSync ( this . resources [ "themes" ] [ "path" ] ) ;
58- } ,
59- create : ( ) => {
60- fs . mkdirSync ( this . resources [ "themes" ] [ "path" ] ) ;
61- } ,
56+ exists : ( ) => fs . existsSync ( this . resources [ "themes" ] [ "path" ] ) ,
57+ create : ( ) => fs . mkdirSync ( this . resources [ "themes" ] [ "path" ] ) ,
6258 } ,
6359 fonts : {
6460 type : "Fonts file" ,
6561 path : `${ this . basePath } /fonts.yaml` ,
66- exists : ( ) => {
67- fs . existsSync ( this . resources [ "fonts" ] [ "path" ] ) ;
68- } ,
69- create : ( ) => {
70- fs . writeFileSync ( this . resources [ "fonts" ] [ "path" ] ) ;
71- } ,
62+ exists : ( ) => fs . existsSync ( this . resources [ "fonts" ] [ "path" ] ) ,
63+ create : ( ) => fs . writeFileSync ( this . resources [ "fonts" ] [ "path" ] ) ,
7264 } ,
7365 } ;
7466 }
@@ -93,7 +85,7 @@ class Alacritty {
9385 }
9486
9587 resource = this . resources [ resource ] ;
96- if ( ! resource [ "exists" ] ) {
88+ if ( ! resource [ "exists" ] ( ) ) {
9789 log ( warning ( `${ resource [ "type" ] } not found` ) ) ;
9890 resource [ "create" ] ( ) ;
9991 log ( "Created resource =>" ) ;
@@ -254,25 +246,29 @@ class Alacritty {
254246 }
255247 }
256248
257- if ( ! ( fonts [ font ] instanceof Object ) ) {
249+ if ( ! ( typeof fonts [ font ] === "object" ) ) {
258250 log ( error ( `Font "${ font } " has wrong format` ) ) ;
259251 process . exit ( ) ;
260252 }
261253
262254 for ( let t in fontTypes ) {
263- if ( ! ( t in Object . keys ( fonts ) ) ) {
264- log ( error ( `Font "${ font } " does not have "${ t } " property` ) ) ;
255+ if ( ! ( fontTypes [ t ] in fonts [ font ] ) ) {
256+ log ( error ( `Font "${ font } " does not have "${ fontTypes [ t ] } " property` ) ) ;
265257 }
266- if ( ! ( t in this . config [ "font" ] ) ) {
258+
259+ if ( ! ( fontTypes [ t ] in this . config [ "font" ] ) ) {
267260 this . config [ "font" ] [ fontTypes [ t ] ] = { family : "tmp" } ;
268261 }
269- this . config [ "font" ] [ fontTypes [ t ] ] [ "family" ] = fonts [ font ] [ fontTypes [ t ] ] ;
262+
263+ this . config [ "font" ] [ fontTypes [ t ] ] [ "family" ] = fonts [ font ] [ fontTypes [ t ] ]
264+ ? fonts [ font ] [ fontTypes [ t ] ]
265+ : "tmp" ;
270266 }
271267 log ( chalk . blue ( `Font ${ font } applied` ) ) ;
272268 }
273269
274270 changePadding ( padding ) {
275- if ( Object . keys ( padding ) . length != 2 ) {
271+ if ( Object . keys ( padding ) . length !== 2 ) {
276272 log ( error ( "Padding should only have an x and y value" ) ) ;
277273 }
278274
@@ -377,7 +373,8 @@ class Alacritty {
377373 } else {
378374 log ( chalk . green . bold . underline ( "Themes" ) ) ;
379375 for ( let theme in themes ) {
380- log ( chalk . green ( `${ themes [ theme ] } ` ) ) ;
376+ const themeName = themes [ theme ] . replace ( ".yaml" , "" ) ;
377+ log ( chalk . green ( `${ themeName } ` ) ) ;
381378 }
382379 }
383380 }
0 commit comments