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)) { if (!isEmpty(path)) {
let containValuePlaceholder = false let containValuePlaceholder = false
cmd = includes(path, ' ') ? `"${path}"` : path cmd = includes(path, ' ') ? `"${path}"` : path
for (let part of args) { if (args) {
part = trim(part) for (let part of args) {
if (isEmpty(part)) { part = trim(part)
continue if (isEmpty(part)) {
} continue
if (includes(part, ' ')) { }
cmd += ' "' + part + '"' if (includes(part, ' ')) {
} else { cmd += ' "' + part + '"'
if (toUpper(part) === '{VALUE}') { } else {
part = '{VALUE}' if (toUpper(part) === '{VALUE}') {
containValuePlaceholder = true part = '{VALUE}'
containValuePlaceholder = true
}
cmd += ' ' + part
} }
cmd += ' ' + part
} }
} }
if (!containValuePlaceholder) { if (!containValuePlaceholder) {