mirror of
https://github.com/immich-app/immich.git
synced 2026-02-22 04:40:34 +09:00
Some checks failed
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Docker / pre-job (push) Waiting to run
Docker / Re-Tag ML () (push) Blocked by required conditions
Docker / Re-Tag ML (-armnn) (push) Blocked by required conditions
Docker / Re-Tag ML (-cuda) (push) Blocked by required conditions
Docker / Re-Tag ML (-openvino) (push) Blocked by required conditions
Docker / Re-Tag ML (-rknn) (push) Blocked by required conditions
Docker / Re-Tag ML (-rocm) (push) Blocked by required conditions
Docker / Re-Tag Server () (push) Blocked by required conditions
Docker / Build and Push ML (armnn, linux/arm64, -armnn) (push) Blocked by required conditions
Docker / Build and Push ML (cpu, ) (push) Blocked by required conditions
Docker / Build and Push ML (cuda, linux/amd64, -cuda) (push) Blocked by required conditions
Docker / Build and Push ML (openvino, linux/amd64, -openvino) (push) Blocked by required conditions
Docker / Build and Push ML (rknn, linux/arm64, -rknn) (push) Blocked by required conditions
Docker / Build and Push ML (rocm, linux/amd64, {"linux/amd64": "mich"}, -rocm) (push) Blocked by required conditions
Docker / Build and Push Server (push) Blocked by required conditions
Docker / Docker Build & Push Server Success (push) Blocked by required conditions
Docker / Docker Build & Push ML Success (push) Blocked by required conditions
Docs build / pre-job (push) Waiting to run
Docs build / Docs Build (push) Blocked by required conditions
Static Code Analysis / pre-job (push) Waiting to run
Static Code Analysis / Run Dart Code Analysis (push) Blocked by required conditions
Static Code Analysis / zizmor (push) Waiting to run
Test / pre-job (push) Waiting to run
Test / Test & Lint Server (push) Blocked by required conditions
Test / Unit Test CLI (push) Blocked by required conditions
Test / Unit Test CLI (Windows) (push) Blocked by required conditions
Test / Lint Web (push) Blocked by required conditions
Test / Test Web (push) Blocked by required conditions
Test / Test i18n (push) Blocked by required conditions
Test / End-to-End Lint (push) Blocked by required conditions
Test / Medium Tests (Server) (push) Blocked by required conditions
Test / End-to-End Tests (Server & CLI) (ubuntu-24.04-arm) (push) Blocked by required conditions
Test / End-to-End Tests (Server & CLI) (ubuntu-latest) (push) Blocked by required conditions
Test / End-to-End Tests (Web) (ubuntu-24.04-arm) (push) Blocked by required conditions
Test / End-to-End Tests (Web) (ubuntu-latest) (push) Blocked by required conditions
Test / End-to-End Tests Success (push) Blocked by required conditions
Test / Unit Test Mobile (push) Blocked by required conditions
Test / Unit Test ML (push) Blocked by required conditions
Test / .github Files Formatting (push) Blocked by required conditions
Test / ShellCheck (push) Waiting to run
Test / OpenAPI Clients (push) Waiting to run
Test / SQL Schema Checks (push) Waiting to run
CLI Build / CLI Publish (push) Has been cancelled
CLI Build / Docker (push) Has been cancelled
* fix(docs): update the cli upload usage The cli upload usage is missing some options compared to what is the current output of `immich upload --help`. Update the docs accordingly. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> * feat(cli): add --json-output option to upload command Add an option that allows retrieving per-file information about the upload process. The output includes the newFiles, duplicates and newAssets lists, but could accommodate more information later if needed. One use case this allows for is using --dry-run to get a list of all the files that would be uploaded, and checking them manually before an upload. This can be particularly useful when a curated subset of images have already been uploaded to immich and we want to double check for some stragglers without uploading everything to immich. The upload command has a few lines of logging, so to get an actually parsable json one needs to strip those lines: immich upload --dry-run * | tail -n +4 | jq .newFiles[] Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> --------- Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
88 lines
3.2 KiB
JavaScript
88 lines
3.2 KiB
JavaScript
#! /usr/bin/env node
|
|
import { Command, Option } from 'commander';
|
|
import os from 'node:os';
|
|
import path from 'node:path';
|
|
import { upload } from 'src/commands/asset';
|
|
import { login, logout } from 'src/commands/auth';
|
|
import { serverInfo } from 'src/commands/server-info';
|
|
import { version } from '../package.json';
|
|
|
|
const defaultConfigDirectory = path.join(os.homedir(), '.config/immich/');
|
|
|
|
const program = new Command()
|
|
.name('immich')
|
|
.version(version)
|
|
.description('Command line interface for Immich')
|
|
.addOption(
|
|
new Option('-d, --config-directory <directory>', 'Configuration directory where auth.yml will be stored')
|
|
.env('IMMICH_CONFIG_DIR')
|
|
.default(defaultConfigDirectory),
|
|
)
|
|
.addOption(new Option('-u, --url [url]', 'Immich server URL').env('IMMICH_INSTANCE_URL'))
|
|
.addOption(new Option('-k, --key [key]', 'Immich API key').env('IMMICH_API_KEY'));
|
|
|
|
program
|
|
.command('login')
|
|
.alias('login-key')
|
|
.description('Login using an API key')
|
|
.argument('url', 'Immich server URL')
|
|
.argument('key', 'Immich API key')
|
|
.action((url, key) => login(url, key, program.opts()));
|
|
|
|
program
|
|
.command('logout')
|
|
.description('Remove stored credentials')
|
|
.action(() => logout(program.opts()));
|
|
|
|
program
|
|
.command('server-info')
|
|
.description('Display server information')
|
|
.action(() => serverInfo(program.opts()));
|
|
|
|
program
|
|
.command('upload')
|
|
.description('Upload assets')
|
|
.usage('[paths...] [options]')
|
|
.addOption(new Option('-r, --recursive', 'Recursive').env('IMMICH_RECURSIVE').default(false))
|
|
.addOption(new Option('-i, --ignore <pattern>', 'Pattern to ignore').env('IMMICH_IGNORE_PATHS'))
|
|
.addOption(new Option('-h, --skip-hash', "Don't hash files before upload").env('IMMICH_SKIP_HASH').default(false))
|
|
.addOption(new Option('-H, --include-hidden', 'Include hidden folders').env('IMMICH_INCLUDE_HIDDEN').default(false))
|
|
.addOption(
|
|
new Option('-a, --album', 'Automatically create albums based on folder name')
|
|
.env('IMMICH_AUTO_CREATE_ALBUM')
|
|
.default(false),
|
|
)
|
|
.addOption(
|
|
new Option('-A, --album-name <name>', 'Add all assets to specified album')
|
|
.env('IMMICH_ALBUM_NAME')
|
|
.conflicts('album'),
|
|
)
|
|
.addOption(
|
|
new Option('-n, --dry-run', "Don't perform any actions, just show what will be done")
|
|
.env('IMMICH_DRY_RUN')
|
|
.default(false)
|
|
.conflicts('skipHash'),
|
|
)
|
|
.addOption(
|
|
new Option('-c, --concurrency <number>', 'Number of assets to upload at the same time')
|
|
.env('IMMICH_UPLOAD_CONCURRENCY')
|
|
.default(4),
|
|
)
|
|
.addOption(
|
|
new Option('-j, --json-output', 'Output detailed information in json format')
|
|
.env('IMMICH_JSON_OUTPUT')
|
|
.default(false),
|
|
)
|
|
.addOption(new Option('--delete', 'Delete local assets after upload').env('IMMICH_DELETE_ASSETS'))
|
|
.addOption(new Option('--no-progress', 'Hide progress bars').env('IMMICH_PROGRESS_BAR').default(true))
|
|
.addOption(
|
|
new Option('--watch', 'Watch for changes and upload automatically')
|
|
.env('IMMICH_WATCH_CHANGES')
|
|
.default(false)
|
|
.implies({ progress: false }),
|
|
)
|
|
.argument('[paths...]', 'One or more paths to assets to be uploaded')
|
|
.action((paths, options) => upload(paths, program.opts(), options));
|
|
|
|
program.parse(process.argv);
|