File tree Expand file tree Collapse file tree
helpers/azureCLIScriptHelpers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,10 +18,7 @@ module.exports = {
1818 ( data . entityData [ entityId ] || [ ] ) [ 0 ] || { } ,
1919 ) ,
2020 ) ;
21- if (
22- data . options . targetScriptOptions &&
23- data . options . targetScriptOptions . keyword === 'containerSettingsJson'
24- ) {
21+ if ( data . options ?. targetScriptOptions ?. keyword === 'containerSettingsJson' ) {
2522 const uniqueKeys = _ . get ( data . containerData , '[0].uniqueKey' , [ ] ) ;
2623 const scriptData = {
2724 partitionKey : getPartitionKey ( _ ) ( data . containerData ) ,
@@ -43,7 +40,6 @@ module.exports = {
4340
4441 const script = buildAzureCLIScript ( _ ) ( {
4542 ...data ,
46- shellName : data . options . targetScriptOptions . keyword . split ( 'azureCli' ) [ 1 ] . toLowerCase ( ) ,
4743 } ) ;
4844
4945 if ( withSamples || ! insertSamplesOption . value ) {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ const { getUniqueKeyPolicyScript } = require('../getUniqueKeyPolicyScript');
44const { getCliParamsDelimiter } = require ( './getCliParamsDelimiter' ) ;
55const getIndexPolicyScript = require ( '../getIndexPolicyScript' ) ;
66const getPartitionKey = require ( '../getPartitionKey' ) ;
7+ const { getCliShellName } = require ( './getCliShellName' ) ;
78const {
89 CLI ,
910 DATABASE ,
@@ -16,7 +17,8 @@ const {
1617
1718const buildAzureCLIScript =
1819 _ =>
19- ( { modelData, containerData, shellName } ) => {
20+ ( { modelData, containerData, options } ) => {
21+ const shellName = getCliShellName ( options ?. targetScriptOptions ) ;
2022 const cliParamsDelimiter = getCliParamsDelimiter ( shellName ) ;
2123 const escapeAndWrapInQuotes = string => wrapInSingleQuotes ( escapeShellCommand ( shellName , string ) ) ;
2224
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