mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
Add more detail for the modes
GitOrigin-RevId: 44b63b76b1edb8bfb78049c9c8560934e340ef96
This commit is contained in:
@@ -14,12 +14,24 @@ import { client } from '../lib/mongodb.js'
|
||||
import archiver from 'archiver'
|
||||
import Events from 'node:events'
|
||||
import { Chunk } from 'overleaf-editor-core'
|
||||
import _ from 'lodash'
|
||||
|
||||
// Silence warning.
|
||||
Events.setMaxListeners(20)
|
||||
|
||||
const SUPPORTED_MODES = ['raw', 'latest']
|
||||
|
||||
// Pads the mode name to a fixed length for better alignment in output.
|
||||
const padModeName = _.partialRight(
|
||||
_.padEnd,
|
||||
Math.max(...SUPPORTED_MODES.map(mode => mode.length))
|
||||
)
|
||||
|
||||
const SUPPORTED_MODES_HELP = {
|
||||
raw: 'Retrieve all chunk and blob files from the project backup.',
|
||||
latest: 'Retrieves the last backed up state of the project.',
|
||||
}
|
||||
|
||||
// outputFile needs to be available in the shutdown function (which may be called before it's declared)
|
||||
// eslint-disable-next-line prefer-const
|
||||
let outputFile
|
||||
@@ -42,10 +54,15 @@ function usage() {
|
||||
console.log(
|
||||
'Usage: node recover_zip_from_backup.mjs --historyId=<historyId> --output=<output> [--mode=<mode>] [--verbose] [--useBackupGlobalBlobs]'
|
||||
)
|
||||
console.log('Supported modes: ' + SUPPORTED_MODES.join(', '))
|
||||
console.log(
|
||||
'--useBackupGlobalBlobs can be used if the global blobs have not been restored from the backup yet.'
|
||||
)
|
||||
console.log('Supported modes: ' + SUPPORTED_MODES.join(', '))
|
||||
SUPPORTED_MODES.forEach(mode => {
|
||||
console.log(
|
||||
` --mode=${padModeName(mode)} - ${SUPPORTED_MODES_HELP[mode] || ''}`
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user