@@ -16,17 +16,27 @@ import { DelayCommand } from './scenario/DelayCommand.js';
16
16
import { ExpectPinCommand } from './scenario/ExpectPinCommand.js' ;
17
17
import { SetControlCommand } from './scenario/SetControlCommand.js' ;
18
18
import { WaitSerialCommand } from './scenario/WaitSerialCommand.js' ;
19
- import { uploadFirmware } from './uploadFirmware.js' ;
20
19
import { WriteSerialCommand } from './scenario/WriteSerialCommand.js' ;
20
+ import { uploadFirmware } from './uploadFirmware.js' ;
21
21
22
22
const millis = 1_000_000 ;
23
23
24
+ function printVersion ( short = false ) {
25
+ const { sha, version } = readVersion ( ) ;
26
+ if ( short ) {
27
+ console . log ( `${ version } (${ sha } )` ) ;
28
+ } else {
29
+ console . log ( `Wokwi CLI v${ version } (${ sha } )` ) ;
30
+ }
31
+ }
32
+
24
33
async function main ( ) {
25
34
const args = arg (
26
35
{
27
36
'--help' : Boolean ,
28
37
'--quiet' : Boolean ,
29
38
'--version' : Boolean ,
39
+ '--short-version' : Boolean ,
30
40
'--diagram-file' : String ,
31
41
'--elf' : String ,
32
42
'--expect-text' : String ,
@@ -60,12 +70,13 @@ async function main() {
60
70
const timeoutExitCode = args [ '--timeout-exit-code' ] ?? 42 ;
61
71
const timeoutNanos = timeout * millis ;
62
72
73
+ if ( args [ '--version' ] === true || args [ '--short-version' ] === true ) {
74
+ printVersion ( args [ '--short-version' ] ) ;
75
+ process . exit ( 0 ) ;
76
+ }
77
+
63
78
if ( ! quiet ) {
64
- const { sha, version } = readVersion ( ) ;
65
- console . log ( `Wokwi CLI v${ version } (${ sha } )` ) ;
66
- if ( args [ '--version' ] ) {
67
- process . exit ( 0 ) ;
68
- }
79
+ printVersion ( ) ;
69
80
}
70
81
71
82
if ( args [ '--help' ] ) {
0 commit comments