File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed
Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -184,13 +184,18 @@ export function fromCl(cl: string): {command: string, parameters: CommandParamet
184184 for ( const c of cl . split ( `` ) ) {
185185 if ( c === `(` ) {
186186 parmDepth ++ ;
187- if ( parmDepth === 1 ) {
187+ if ( parmDepth > 1 ) {
188+ // If we are already in a parameter, we just add the character to the value
189+ currentParmValue += c ;
188190 }
189191 } else if ( c === `)` ) {
190192 if ( parmDepth === 1 ) {
191193 parameters [ currentParmName . toLowerCase ( ) ] = currentParmValue ;
192194 currentParmValue = `` ;
193195 currentParmName = `` ;
196+ } else {
197+ // If we are deeper than 1, we just add the character to the value
198+ currentParmValue += c ;
194199 }
195200 parmDepth -- ;
196201 } else if ( c === ` ` && ! gotCommandnName ) {
@@ -226,12 +231,17 @@ export function toCl(command: string, parameters?: CommandParameters) {
226231 for ( const [ key , value ] of Object . entries ( parameters ) ) {
227232 let parmValue ;
228233
229- if ( value && value . trim ( ) !== `` ) {
230- if ( value === value . toLocaleUpperCase ( ) ) {
234+ if ( value ) {
235+ if ( value . startsWith ( `'` ) && value . endsWith ( `'` ) ) {
231236 parmValue = value ;
232- } else {
233- parmValue = value . replace ( / ' / g, `''` ) ;
234- parmValue = `'${ parmValue } '` ;
237+ }
238+ else if ( value . trim ( ) !== `` ) {
239+ if ( value === value . toLocaleUpperCase ( ) ) {
240+ parmValue = value ;
241+ } else {
242+ parmValue = value . replace ( / ' / g, `''` ) ;
243+ parmValue = `'${ parmValue } '` ;
244+ }
235245 }
236246
237247 cl += ` ${ key . toUpperCase ( ) } (${ parmValue } )` ;
You can’t perform that action at this time.
0 commit comments