@@ -26,6 +26,7 @@ async function main() {
26
26
'--help' : Boolean ,
27
27
'--quiet' : Boolean ,
28
28
'--version' : Boolean ,
29
+ '--diagram-file' : String ,
29
30
'--elf' : String ,
30
31
'--expect-text' : String ,
31
32
'--fail-text' : String ,
@@ -48,6 +49,7 @@ async function main() {
48
49
const expectText = args [ '--expect-text' ] ;
49
50
const failText = args [ '--fail-text' ] ;
50
51
const interactive = args [ '--interactive' ] ;
52
+ const diagramFile = args [ '--diagram-file' ] ;
51
53
const serialLogFile = args [ '--serial-log-file' ] ;
52
54
const scenarioFile = args [ '--scenario' ] ;
53
55
const timeout = args [ '--timeout' ] ?? 30000 ;
@@ -76,16 +78,16 @@ async function main() {
76
78
}
77
79
78
80
const rootDir = args . _ [ 0 ] || '.' ;
79
- const configPath = ` ${ rootDir } / wokwi.toml` ;
80
- const diagramFile = ` ${ rootDir } / diagram.json` ;
81
+ const configPath = path . join ( rootDir , ' wokwi.toml' ) ;
82
+ const diagramFilePath = path . join ( rootDir , diagramFile ?? ' diagram.json' ) ;
81
83
const configExists = existsSync ( configPath ) ;
82
84
83
85
if ( ! elf && ! configExists ) {
84
86
console . error ( `Error: wokwi.toml not found in ${ path . resolve ( rootDir ) } ` ) ;
85
87
process . exit ( 1 ) ;
86
88
}
87
89
88
- if ( ! existsSync ( diagramFile ) ) {
90
+ if ( ! existsSync ( diagramFilePath ) ) {
89
91
console . error ( `Error: diagram.json not found in ${ path . resolve ( rootDir ) } ` ) ;
90
92
process . exit ( 1 ) ;
91
93
}
@@ -117,7 +119,7 @@ async function main() {
117
119
process . exit ( 1 ) ;
118
120
}
119
121
120
- const diagram = readFileSync ( diagramFile , 'utf8' ) ;
122
+ const diagram = readFileSync ( diagramFilePath , 'utf8' ) ;
121
123
122
124
const chips = loadChips ( config ?. chip ?? [ ] , rootDir ) ;
123
125
0 commit comments