File tree Expand file tree Collapse file tree 3 files changed +16
-6
lines changed
helpers/azureCLIScriptHelpers Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -18,10 +18,7 @@ module.exports = {
18
18
( data . entityData [ entityId ] || [ ] ) [ 0 ] || { } ,
19
19
) ,
20
20
) ;
21
- if (
22
- data . options . targetScriptOptions &&
23
- data . options . targetScriptOptions . keyword === 'containerSettingsJson'
24
- ) {
21
+ if ( data . options ?. targetScriptOptions ?. keyword === 'containerSettingsJson' ) {
25
22
const uniqueKeys = _ . get ( data . containerData , '[0].uniqueKey' , [ ] ) ;
26
23
const scriptData = {
27
24
partitionKey : getPartitionKey ( _ ) ( data . containerData ) ,
@@ -43,7 +40,6 @@ module.exports = {
43
40
44
41
const script = buildAzureCLIScript ( _ ) ( {
45
42
...data ,
46
- shellName : data . options . targetScriptOptions . keyword . split ( 'azureCli' ) [ 1 ] . toLowerCase ( ) ,
47
43
} ) ;
48
44
49
45
if ( withSamples || ! insertSamplesOption . value ) {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ const { getUniqueKeyPolicyScript } = require('../getUniqueKeyPolicyScript');
4
4
const { getCliParamsDelimiter } = require ( './getCliParamsDelimiter' ) ;
5
5
const getIndexPolicyScript = require ( '../getIndexPolicyScript' ) ;
6
6
const getPartitionKey = require ( '../getPartitionKey' ) ;
7
+ const { getCliShellName } = require ( './getCliShellName' ) ;
7
8
const {
8
9
CLI ,
9
10
DATABASE ,
@@ -16,7 +17,8 @@ const {
16
17
17
18
const buildAzureCLIScript =
18
19
_ =>
19
- ( { modelData, containerData, shellName } ) => {
20
+ ( { modelData, containerData, options } ) => {
21
+ const shellName = getCliShellName ( options ?. targetScriptOptions ) ;
20
22
const cliParamsDelimiter = getCliParamsDelimiter ( shellName ) ;
21
23
const escapeAndWrapInQuotes = string => wrapInSingleQuotes ( escapeShellCommand ( shellName , string ) ) ;
22
24
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @param {object } targetScriptOptions
3
+ * @returns {string }
4
+ */
5
+ const getCliShellName = ( targetScriptOptions = { } ) => {
6
+ const keyword = targetScriptOptions . keyword ?? '' ;
7
+ const [ , shellName = '' ] = keyword . split ( 'azureCli' ) ;
8
+
9
+ return shellName . toLowerCase ( ) ;
10
+ } ;
11
+
12
+ module . exports = { getCliShellName } ;
You can’t perform that action at this time.
0 commit comments