This repository was archived by the owner on Mar 8, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +27
-10
lines changed Expand file tree Collapse file tree 3 files changed +27
-10
lines changed Original file line number Diff line number Diff line change 1
1
import fs from "fs" ;
2
2
import os from "os" ;
3
3
import path from "path" ;
4
+ import { KmdrError } from "./errors" ;
4
5
import { Settings , SettingsFile , Theme } from "./interfaces" ;
5
6
import ThemeManager from "./ThemeManager" ;
6
7
@@ -48,7 +49,7 @@ export default class SettingsManager implements Settings {
48
49
49
50
this . loadAllThemes ( ) ;
50
51
// If directory does not exists, use default settings
51
- if ( ! fs . existsSync ( this . settingsPath ) ) {
52
+ if ( ! fs . existsSync ( path . join ( this . settingsPath , "settings.json" ) ) ) {
52
53
this . loadDefault ( ) ;
53
54
} else {
54
55
this . loadFromDisk ( ) ;
@@ -104,6 +105,10 @@ export default class SettingsManager implements Settings {
104
105
} else {
105
106
const parsedFile = JSON . parse ( file ) as SettingsFile ;
106
107
108
+ if ( parsedFile . theme . trim ( ) === "" ) {
109
+ throw new KmdrError ( "KMDR_CLI_INVALID_THEME_NAME" , 201 , `Settings file is invalid` ) ;
110
+ }
111
+
107
112
this . theme = this . loadTheme ( parsedFile . theme ) || new ThemeManager ( DEFAULT_THEME ) ;
108
113
}
109
114
} catch ( err ) {
Original file line number Diff line number Diff line change 4
4
"palette" : {
5
5
"argument" : {
6
6
"bold" : true ,
7
- "foreground" : " #f8f8f2 " ,
7
+ "foreground" : " #575F66 " ,
8
8
"italic" : true
9
9
},
10
10
"comment" : {
11
- "foreground" : " #6272a4"
11
+ "foreground" : " #ABB0B6"
12
+ },
13
+ "function" : {
14
+ "foreground" : " #F2AE49"
12
15
},
13
16
"keyword" : {
14
17
"foreground" : " #ff5555"
17
20
"foreground" : " #f1fa8c"
18
21
},
19
22
"option" : {
20
- "foreground" : " #50fa7b"
23
+ "foreground" : " #399EE6" ,
24
+ "bold" : true
21
25
},
22
26
"program" : {
23
- "foreground" : " #224466"
27
+ "foreground" : " #F2AE49" ,
28
+ "bold" : true
24
29
},
25
30
"subcommand" : {
26
- "foreground" : " #bd93f9"
31
+ "foreground" : " #4CBF99" ,
32
+ "bold" : true
33
+ },
34
+ "varName" : {
35
+ "foreground" : " #F07171" ,
36
+ "bold" : true
27
37
},
28
38
"tokenKind" : {
29
39
"background" : " #222222" ,
30
-
31
40
"foreground" : " #AA5599"
32
41
}
33
42
}
Original file line number Diff line number Diff line change 17
17
"foreground" : " #f1fa8c"
18
18
},
19
19
"option" : {
20
- "foreground" : " #50fa7b"
20
+ "foreground" : " #50fa7b" ,
21
+ "bold" : true
21
22
},
22
23
"program" : {
23
- "foreground" : " #FFC0CB"
24
+ "foreground" : " #FFC0CB" ,
25
+ "bold" : true
24
26
},
25
27
"subcommand" : {
26
- "foreground" : " #bd93f9"
28
+ "foreground" : " #bd93f9" ,
29
+ "bold" : true
27
30
},
28
31
"tokenKind" : {
29
32
"background" : " #222222" ,
You can’t perform that action at this time.
0 commit comments