From 72c90034991627a356405dc1b2aab89192e4fb68 Mon Sep 17 00:00:00 2001 From: Lorenzo Montanari <13736036+l0ll098@users.noreply.github.com> Date: Wed, 25 Jun 2025 16:43:11 +0200 Subject: [PATCH] chore: ran prettier --- cli/src/commands/jobs.ts | 84 ++++++++++++++++++++++++---------------- cli/src/index.ts | 18 ++++----- 2 files changed, 58 insertions(+), 44 deletions(-) diff --git a/cli/src/commands/jobs.ts b/cli/src/commands/jobs.ts index 481c469d36..085a1c4043 100644 --- a/cli/src/commands/jobs.ts +++ b/cli/src/commands/jobs.ts @@ -5,7 +5,7 @@ import { JobCountsDto, JobName, JobStatusDto, - sendJobCommand + sendJobCommand, } from '@immich/sdk'; import { authenticate, BaseOptions, logError, withError } from 'src/utils'; @@ -42,7 +42,11 @@ const JOB_STATUS_COLUMN_HEADERS: Readonly> = * @param baseOptions Immich CLI base options. * @param commandOptions Options for the command, such as whether to output in JSON format. */ -export async function getJobsStatus(jobName: JobName | undefined, baseOptions: BaseOptions, commandOptions: GetJobStatusOptions) { +export async function getJobsStatus( + jobName: JobName | undefined, + baseOptions: BaseOptions, + commandOptions: GetJobStatusOptions, +) { await authenticate(baseOptions); if (jobName) { @@ -75,13 +79,15 @@ export async function startJob(jobName: JobName, baseOptions: BaseOptions, comma force = undefined; } - const [error, response] = await withError(sendJobCommand({ - id: jobName, - jobCommandDto: { - command: JobCommand.Start, - force, - } - })); + const [error, response] = await withError( + sendJobCommand({ + id: jobName, + jobCommandDto: { + command: JobCommand.Start, + force, + }, + }), + ); if (error) { logError(error, `Failed to start job: ${jobName}. Got error`); @@ -117,12 +123,14 @@ export async function pauseJobExecutions(jobName: JobName, baseOptions: BaseOpti ensureJobNameIsValid(jobName); - const [error, response] = await withError(sendJobCommand({ - id: jobName, - jobCommandDto: { - command: JobCommand.Pause - } - })); + const [error, response] = await withError( + sendJobCommand({ + id: jobName, + jobCommandDto: { + command: JobCommand.Pause, + }, + }), + ); if (error) { logError(error, `Failed to pause executions of job "${jobName}". Got error`); @@ -143,17 +151,23 @@ export async function pauseJobExecutions(jobName: JobName, baseOptions: BaseOpti * @param baseOptions Immich CLI base options. * @param commandOptions Options for the command, such as whether to output in JSON format. */ -export async function resumeJobExecutions(jobName: JobName, baseOptions: BaseOptions, commandOptions: ResumeJobOptions) { +export async function resumeJobExecutions( + jobName: JobName, + baseOptions: BaseOptions, + commandOptions: ResumeJobOptions, +) { await authenticate(baseOptions); ensureJobNameIsValid(jobName); - const [error, response] = await withError(sendJobCommand({ - id: jobName, - jobCommandDto: { - command: JobCommand.Resume - } - })); + const [error, response] = await withError( + sendJobCommand({ + id: jobName, + jobCommandDto: { + command: JobCommand.Resume, + }, + }), + ); if (error) { logError(error, `Failed to resume executions of job "${jobName}". Got error`); @@ -207,19 +221,21 @@ async function getStatusOfAllJobs(commandOptions: CommonJobStatusOptions) { return; } - console.table(Object.entries(status).map(([name, status]) => { - const row: Record = { - name, - isQueueActive: status.queueStatus.isActive, - isQueuePaused: status.queueStatus.isPaused, - }; + console.table( + Object.entries(status).map(([name, status]) => { + const row: Record = { + name, + isQueueActive: status.queueStatus.isActive, + isQueuePaused: status.queueStatus.isPaused, + }; - for (const [key, value] of Object.entries(status.jobCounts)) { - row[JOB_STATUS_COLUMN_HEADERS[key as keyof JobCountsDto]] = value; - } + for (const [key, value] of Object.entries(status.jobCounts)) { + row[JOB_STATUS_COLUMN_HEADERS[key as keyof JobCountsDto]] = value; + } - return row; - })); + return row; + }), + ); } /** @@ -237,7 +253,7 @@ async function waitForJobCompletion(jobName: JobName): Promise { return jobStatus; } - await new Promise(resolve => setTimeout(resolve, 1000)); + await new Promise((resolve) => setTimeout(resolve, 1000)); } } diff --git a/cli/src/index.ts b/cli/src/index.ts index 769ca3de93..6fa2640943 100644 --- a/cli/src/index.ts +++ b/cli/src/index.ts @@ -35,8 +35,7 @@ program .description('Remove stored credentials') .action(() => logout(program.opts())); -const jobsCommand = program.createCommand('jobs') - .description('Manage background jobs'); +const jobsCommand = program.createCommand('jobs').description('Manage background jobs'); jobsCommand .command('pause') @@ -68,7 +67,7 @@ jobsCommand .usage(' [options]') .addOption( new Option('-w, --wait', 'Wait for the job to complete before returning') - .env("IMMICH_WAIT_JOB_COMPLETION") + .env('IMMICH_WAIT_JOB_COMPLETION') .default(false), ) .addOption( @@ -77,7 +76,10 @@ jobsCommand .default(false), ) .addOption( - new Option('--all', 'Execute this job on all assets. Depending on the job, this may clear existing data previously created by the job') + new Option( + '--all', + 'Execute this job on all assets. Depending on the job, this may clear existing data previously created by the job', + ) .conflicts('refresh') .conflicts('onlyMissing'), ) @@ -87,16 +89,12 @@ jobsCommand .conflicts('all') .conflicts('refresh'), ) - .addOption( - new Option('--refresh', '(Re)run this job on all assets') - .conflicts('all') - .conflicts('onlyMissing'), - ) + .addOption(new Option('--refresh', '(Re)run this job on all assets').conflicts('all').conflicts('onlyMissing')) .argument('', 'Name of the job to run') .action((jobName, options) => startJob(jobName, program.opts(), options)); jobsCommand - .command("status") + .command('status') .description('Get the status of all jobs or the status of a specific job') .usage('[jobName] [options]') .addOption(