@@ -4,21 +4,25 @@ import { bold, red, magenta, cyan } from 'chalk';
4
4
import { runScriptAPI } from '../api' ;
5
5
import { dbLogger } from '../util/logger' ;
6
6
import { loadConfig , resolveConnections } from '..' ;
7
+ import { validateScriptFileName } from '../util/fs' ;
7
8
import { printLine , printError , printInfo } from '../util/io' ;
8
9
import OperationResult from '../domain/operation/OperationResult' ;
9
10
10
11
class RunScript extends Command {
11
12
static description = 'Run the provided manual scripts.' ;
12
13
14
+
13
15
static flags = {
14
16
'dry-run' : flags . boolean ( { description : 'Dry run script.' , default : false } ) ,
15
17
only : flags . string ( {
16
18
helpValue : 'CONNECTION_ID(s)' ,
17
19
description : 'Filter provided connection(s). Comma separated ids eg: id1,id2'
18
20
} ) ,
19
21
file : flags . string ( {
22
+ required : true ,
20
23
helpValue : 'Script Name' ,
21
- description : 'Name of the manual SQL/JS/TS script'
24
+ parse : validateScriptFileName ,
25
+ description : 'Name of the manual SQL/JS/TS script' ,
22
26
} ) ,
23
27
'connection-resolver' : flags . string ( {
24
28
helpValue : 'PATH' ,
@@ -30,6 +34,8 @@ class RunScript extends Command {
30
34
} )
31
35
} ;
32
36
37
+
38
+
33
39
/**
34
40
* Started event handler.
35
41
*/
@@ -110,3 +116,4 @@ class RunScript extends Command {
110
116
}
111
117
112
118
export default RunScript ;
119
+
0 commit comments