37 lines
909 B
JavaScript
37 lines
909 B
JavaScript
|
|
/**
|
|||
|
|
* Command: confirm — 人工确认分镜图
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
const { loadManifest, saveManifest } = require('./pipeline-utils')
|
|||
|
|
|
|||
|
|
function confirmManifest(options) {
|
|||
|
|
const { manifest: manifestPath, all } = options
|
|||
|
|
|
|||
|
|
if (!manifestPath) {
|
|||
|
|
console.error('用法: pipeline.js confirm --manifest <path> --all')
|
|||
|
|
process.exit(1)
|
|||
|
|
}
|
|||
|
|
if (!all) {
|
|||
|
|
console.error('错误: 必须指定 --all')
|
|||
|
|
process.exit(1)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
const manifest = loadManifest(manifestPath)
|
|||
|
|
|
|||
|
|
let count = 0
|
|||
|
|
for (const item of manifest.items) {
|
|||
|
|
if (item.file && item.status === 'done' && !item.confirmed) {
|
|||
|
|
item.confirmed = true
|
|||
|
|
count++
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
saveManifest(manifestPath, manifest)
|
|||
|
|
|
|||
|
|
const total = manifest.items.length
|
|||
|
|
const confirmed = manifest.items.filter(it => it.confirmed).length
|
|||
|
|
console.log(`已确认: ${count} items(共 ${confirmed}/${total} 已确认)`)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
module.exports = { confirmManifest }
|