@@ -16,17 +16,27 @@ import { DelayCommand } from './scenario/DelayCommand.js';
1616import { ExpectPinCommand } from './scenario/ExpectPinCommand.js' ;
1717import { SetControlCommand } from './scenario/SetControlCommand.js' ;
1818import { WaitSerialCommand } from './scenario/WaitSerialCommand.js' ;
19- import { uploadFirmware } from './uploadFirmware.js' ;
2019import { WriteSerialCommand } from './scenario/WriteSerialCommand.js' ;
20+ import { uploadFirmware } from './uploadFirmware.js' ;
2121
2222const millis = 1_000_000 ;
2323
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+
2433async function main ( ) {
2534 const args = arg (
2635 {
2736 '--help' : Boolean ,
2837 '--quiet' : Boolean ,
2938 '--version' : Boolean ,
39+ '--short-version' : Boolean ,
3040 '--diagram-file' : String ,
3141 '--elf' : String ,
3242 '--expect-text' : String ,
@@ -60,12 +70,13 @@ async function main() {
6070 const timeoutExitCode = args [ '--timeout-exit-code' ] ?? 42 ;
6171 const timeoutNanos = timeout * millis ;
6272
73+ if ( args [ '--version' ] === true || args [ '--short-version' ] === true ) {
74+ printVersion ( args [ '--short-version' ] ) ;
75+ process . exit ( 0 ) ;
76+ }
77+
6378 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 ( ) ;
6980 }
7081
7182 if ( args [ '--help' ] ) {
0 commit comments