mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
17 lines
339 B
JavaScript
17 lines
339 B
JavaScript
const fileTypes = {
|
|
file: '-f',
|
|
folder: '-d',
|
|
link: '-L',
|
|
socket: '-S',
|
|
}
|
|
|
|
// eslint-disable-next-line import/prefer-default-export
|
|
export function buildFileCheckCmd(files) {
|
|
return files
|
|
.map(
|
|
({ path, type, exists }) =>
|
|
`${exists ? '' : '! '}test ${fileTypes[type] || '-e'} ${path}`
|
|
)
|
|
.join(' && ')
|
|
}
|