@@ -14,12 +14,16 @@ class Args {
14
14
pythonExe : string ;
15
15
dotFile : string ;
16
16
17
- constructor ( pass_vault_path : boolean , pass_current_file : boolean , additional_args : string [ ] , prompted : boolean [ ] ) {
17
+ constructor ( pass_vault_path : boolean , pass_current_file : boolean , additional_args : string [ ] , prompted : boolean [ ] , pythonExe : string = "" , dotFile : string = "" ) {
18
18
this . pass_vault_path = pass_vault_path ;
19
19
this . pass_current_file = pass_current_file ;
20
+
20
21
this . additional_args = additional_args ;
21
22
this . prompted = prompted ;
22
23
this . length = additional_args . length ;
24
+
25
+ this . pythonExe = pythonExe ;
26
+ this . dotFile = dotFile ;
23
27
}
24
28
}
25
29
@@ -100,6 +104,7 @@ export default class PythonScripterPlugin extends Plugin {
100
104
// Setting Environment Variables
101
105
let dot_file = additional_args . dotFile ;
102
106
if ( dot_file != "" ) {
107
+ // console.log(`${dot_file}`);
103
108
if ( ! path . isAbsolute ( dot_file ) ) {
104
109
dot_file = path . join ( basePath , dot_file ) ;
105
110
}
@@ -130,15 +135,14 @@ export default class PythonScripterPlugin extends Plugin {
130
135
131
136
if ( additional_args . pythonExe != "" ) {
132
137
python_exe = additional_args . pythonExe ;
138
+ if ( ! fs . existsSync ( python_exe ) ) {
139
+ new Notice ( `Python Exe: $python_exe} for ${ fileName } does not exist` )
140
+ console . log ( `Python Exe: ${ python_exe } for ${ fileName } does not exist` )
141
+ return ;
142
+ }
133
143
}
134
- if ( ! fs . existsSync ( python_exe ) ) {
135
- new Notice ( `Python Exe: $python_exe} for ${ fileName } does not exist` )
136
- console . log ( `Python Exe: ${ python_exe } for ${ fileName } does not exist` )
137
- return ;
138
- }
139
-
140
144
141
- console . log ( `Python Exe: ${ python_exe } ` )
145
+ // console.log(`Python Exe: ${python_exe}`)
142
146
143
147
// Getting Main File
144
148
let main_file = "" ;
@@ -199,7 +203,7 @@ export default class PythonScripterPlugin extends Plugin {
199
203
await sleep ( 20 ) ;
200
204
201
205
}
202
- console . log ( `Arg ${ i + 1 } : ${ args [ i + buffer ] } ` ) ;
206
+ // console.log(`Arg ${i + 1}: ${args[i + buffer]}`);
203
207
}
204
208
// Running the script
205
209
let command = `${ python_exe } \"${ main_file } \"` ;
@@ -384,27 +388,27 @@ class PythonScripterSettingTab extends PluginSettingTab {
384
388
new Setting ( containerEl )
385
389
. setName ( `Arg ${ i + 3 } ` )
386
390
. addText ( ( area ) => {
391
+ const index = i ;
387
392
area
388
393
. setPlaceholder ( 'Enter argument' )
389
- . setValue ( this . plugin . settings . args [ file ] . additional_args [ i ] )
390
- . onChange ( async ( value ) => {
391
- this . plugin . settings . args [ file ] . additional_args [ i ] = value ;
392
- await this . plugin . saveSettings ( ) ;
394
+ . setValue ( this . plugin . settings . args [ file ] . additional_args [ index ] )
395
+ . onChange ( ( value ) => {
396
+ this . plugin . settings . args [ file ] . additional_args [ index ] = value ;
397
+ this . plugin . saveSettings ( ) ;
393
398
} ) ;
394
399
} ) ;
395
400
new Setting ( containerEl )
396
401
. setName ( `Prompt User for Arg ${ i + 3 } ` )
397
402
. setDesc ( `Whether to prompt user for manual input for arg ${ i + 3 } ` )
398
403
. addToggle ( ( area ) => {
404
+ const index = i ;
399
405
area
400
406
. setValue ( this . plugin . settings . args [ file ] . prompted [ i ] )
401
- . onChange ( async ( value ) => {
402
- console . log ( this . plugin . settings . args [ file ] ) ;
403
- this . plugin . settings . args [ file ] . prompted [ i ] = value ;
404
- console . log ( this . plugin . settings . args [ file ] ) ;
407
+ . onChange ( ( value ) => {
408
+ this . plugin . settings . args [ file ] . prompted [ index ] = value ;
405
409
resize ( this . plugin . settings . args [ file ] . additional_args , this . plugin . settings . args [ file ] . length , "" ) ;
406
410
resize ( this . plugin . settings . args [ file ] . prompted , this . plugin . settings . args [ file ] . length , false ) ;
407
- await this . plugin . saveSettings ( ) ;
411
+ this . plugin . saveSettings ( ) ;
408
412
} ) ;
409
413
} ) ;
410
414
}
@@ -422,27 +426,27 @@ class PythonScripterSettingTab extends PluginSettingTab {
422
426
new Setting ( containerEl )
423
427
. setName ( `Arg ${ i + 2 } ` )
424
428
. addText ( ( area ) => {
429
+ const index = i ;
425
430
area
426
431
. setPlaceholder ( 'Enter argument' )
427
- . setValue ( this . plugin . settings . args [ file ] . additional_args [ i ] )
428
- . onChange ( async ( value ) => {
429
- this . plugin . settings . args [ file ] . additional_args [ i ] = value ;
430
- await this . plugin . saveSettings ( ) ;
432
+ . setValue ( this . plugin . settings . args [ file ] . additional_args [ index ] )
433
+ . onChange ( ( value ) => {
434
+ this . plugin . settings . args [ file ] . additional_args [ index ] = value ;
435
+ this . plugin . saveSettings ( ) ;
431
436
} ) ;
432
437
} ) ;
433
438
new Setting ( containerEl )
434
439
. setName ( `Prompt User for Arg ${ i + 2 } ` )
435
440
. setDesc ( `Whether to prompt user for manual input for arg ${ i + 2 } ` )
436
441
. addToggle ( ( area ) => {
442
+ const index = i ;
437
443
area
438
- . setValue ( this . plugin . settings . args [ file ] . prompted [ i ] )
439
- . onChange ( async ( value ) => {
440
- console . log ( this . plugin . settings . args [ file ] ) ;
441
- this . plugin . settings . args [ file ] . prompted [ i ] = value ;
442
- console . log ( this . plugin . settings . args [ file ] ) ;
444
+ . setValue ( this . plugin . settings . args [ file ] . prompted [ index ] )
445
+ . onChange ( ( value ) => {
446
+ this . plugin . settings . args [ file ] . prompted [ index ] = value ;
443
447
resize ( this . plugin . settings . args [ file ] . additional_args , this . plugin . settings . args [ file ] . length , "" ) ;
444
448
resize ( this . plugin . settings . args [ file ] . prompted , this . plugin . settings . args [ file ] . length , false ) ;
445
- await this . plugin . saveSettings ( ) ;
449
+ this . plugin . saveSettings ( ) ;
446
450
} ) ;
447
451
} ) ;
448
452
}
@@ -460,27 +464,27 @@ class PythonScripterSettingTab extends PluginSettingTab {
460
464
new Setting ( containerEl )
461
465
. setName ( `Arg ${ i + 2 } ` )
462
466
. addText ( ( area ) => {
467
+ const index = i ;
463
468
area
464
469
. setPlaceholder ( 'Enter argument' )
465
- . setValue ( this . plugin . settings . args [ file ] . additional_args [ i ] )
466
- . onChange ( async ( value ) => {
467
- this . plugin . settings . args [ file ] . additional_args [ i ] = value ;
468
- await this . plugin . saveSettings ( ) ;
470
+ . setValue ( this . plugin . settings . args [ file ] . additional_args [ index ] )
471
+ . onChange ( ( value ) => {
472
+ this . plugin . settings . args [ file ] . additional_args [ index ] = value ;
473
+ this . plugin . saveSettings ( ) ;
469
474
} ) ;
470
475
} ) ;
471
476
new Setting ( containerEl )
472
477
. setName ( `Prompt User for Arg ${ i + 2 } ` )
473
478
. setDesc ( `Whether to prompt user for manual input for arg ${ i + 2 } ` )
474
479
. addToggle ( ( area ) => {
480
+ const index = i ;
475
481
area
476
482
. setValue ( this . plugin . settings . args [ file ] . prompted [ i ] )
477
- . onChange ( async ( value ) => {
478
- console . log ( this . plugin . settings . args [ file ] ) ;
479
- this . plugin . settings . args [ file ] . prompted [ i ] = value ;
480
- console . log ( this . plugin . settings . args [ file ] ) ;
483
+ . onChange ( ( value ) => {
484
+ this . plugin . settings . args [ file ] . prompted [ index ] = value ;
481
485
resize ( this . plugin . settings . args [ file ] . additional_args , this . plugin . settings . args [ file ] . length , "" ) ;
482
486
resize ( this . plugin . settings . args [ file ] . prompted , this . plugin . settings . args [ file ] . length , false ) ;
483
- await this . plugin . saveSettings ( ) ;
487
+ this . plugin . saveSettings ( ) ;
484
488
} ) ;
485
489
} ) ;
486
490
}
@@ -489,28 +493,27 @@ class PythonScripterSettingTab extends PluginSettingTab {
489
493
new Setting ( containerEl )
490
494
. setName ( `Arg ${ i + 1 } ` )
491
495
. addText ( ( area ) => {
492
-
496
+ const index = i ;
493
497
area
494
498
. setPlaceholder ( 'Enter argument' )
495
499
. setValue ( this . plugin . settings . args [ file ] . additional_args [ i ] )
496
500
. onChange ( async ( value ) => {
497
- this . plugin . settings . args [ file ] . additional_args [ i ] = value ;
501
+ this . plugin . settings . args [ file ] . additional_args [ index ] = value ;
498
502
await this . plugin . saveSettings ( ) ;
499
503
} ) ;
500
504
} ) ;
501
505
new Setting ( containerEl )
502
506
. setName ( `Prompt User for Arg ${ i + 1 } ` )
503
507
. setDesc ( `Whether to prompt user for manual input for arg ${ i + 1 } ` )
504
508
. addToggle ( ( area ) => {
509
+ const index = i ;
505
510
area
506
511
. setValue ( this . plugin . settings . args [ file ] . prompted [ i ] )
507
- . onChange ( async ( value ) => {
508
- console . log ( this . plugin . settings . args [ file ] ) ;
509
- this . plugin . settings . args [ file ] . prompted [ i ] = value ;
510
- console . log ( this . plugin . settings . args [ file ] ) ;
512
+ . onChange ( ( value ) => {
513
+ this . plugin . settings . args [ file ] . prompted [ index ] = value ;
511
514
resize ( this . plugin . settings . args [ file ] . additional_args , this . plugin . settings . args [ file ] . length , "" ) ;
512
515
resize ( this . plugin . settings . args [ file ] . prompted , this . plugin . settings . args [ file ] . length , false ) ;
513
- await this . plugin . saveSettings ( ) ;
516
+ this . plugin . saveSettings ( ) ;
514
517
} ) ;
515
518
} ) ;
516
519
}
0 commit comments