fix: args is not iterable

This commit is contained in:
wxip 2024-05-24 15:28:35 +08:00
parent b4405eb7db
commit 4d754673e7
1 changed files with 14 additions and 12 deletions

View File

@ -13,19 +13,21 @@ export const joinCommand = (path, args = [], emptyContent = '-') => {
if (!isEmpty(path)) {
let containValuePlaceholder = false
cmd = includes(path, ' ') ? `"${path}"` : path
for (let part of args) {
part = trim(part)
if (isEmpty(part)) {
continue
}
if (includes(part, ' ')) {
cmd += ' "' + part + '"'
} else {
if (toUpper(part) === '{VALUE}') {
part = '{VALUE}'
containValuePlaceholder = true
if (args) {
for (let part of args) {
part = trim(part)
if (isEmpty(part)) {
continue
}
if (includes(part, ' ')) {
cmd += ' "' + part + '"'
} else {
if (toUpper(part) === '{VALUE}') {
part = '{VALUE}'
containValuePlaceholder = true
}
cmd += ' ' + part
}
cmd += ' ' + part
}
}
if (!containValuePlaceholder) {