Skip to content

Commit

Permalink
refactor: add check before creating short function title
Browse files Browse the repository at this point in the history
  • Loading branch information
iiroj authored and okonet committed Oct 8, 2019
1 parent 8c3ca58 commit 403f80b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/makeCmdTasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ module.exports = async function makeCmdTasks({ commands, files, gitDir, shell })
}

commands.forEach((command, i) => {
// If command is a function, use the matching mock command as title,
// but since might include multiple [file] arguments, shorten to one
const title = isFn ? mockCommands[i].replace(/\[file\].*\[file\]/, '[file]') : command
let title = isFn ? '[Function]' : command
if (isFn && mockCommands[i]) {
// If command is a function, use the matching mock command as title,
// but since might include multiple [file] arguments, shorten to one
title = mockCommands[i].replace(/\[file\].*\[file\]/, '[file]')
}

const task = { title, task: resolveTaskFn({ gitDir, isFn, command, files, shell }) }
tasks.push(task)
})
Expand Down

0 comments on commit 403f80b

Please sign in to comment.