* Allow building and installing cli * feat: add format fix * docs: remove cli folder * feat: use immich scoped package * feat: rewrite cli readme * docs: add info on running without building * cleanup * chore: remove import functionality from cli * feat: add logout to cli * docs: add todo for file format from server * docs: add compilation step to cli * fix: success message spacing * feat: can create albums * fix: add check step to cli * fix: typos * feat: pull file formats from server * chore: use crawl service from server * chore: fix lint * docs: add cli documentation * chore: rename ignore pattern * chore: add version number to cli * feat: use sdk * fix: cleanup * feat: album name on windows * chore: remove skipped asset field * feat: add more info to server-info command * chore: cleanup * chore: remove unneeded packages * chore: fix docs links * feat: add cli v2 milestone * fix: set correct cli date --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
59 lines
1.8 KiB
JavaScript
59 lines
1.8 KiB
JavaScript
#! /usr/bin/env node
|
|
|
|
import { program, Option } from 'commander';
|
|
import Upload from './commands/upload';
|
|
import ServerInfo from './commands/server-info';
|
|
import LoginKey from './commands/login/key';
|
|
import Logout from './commands/logout';
|
|
|
|
program.name('immich').description('Immich command line interface');
|
|
|
|
program
|
|
.command('upload')
|
|
.description('Upload assets')
|
|
.usage('[options] [paths...]')
|
|
.addOption(new Option('-r, --recursive', 'Recursive').env('IMMICH_RECURSIVE').default(false))
|
|
.addOption(new Option('-i, --ignore [paths...]', 'Paths 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('-a, --album', 'Automatically create albums based on folder name')
|
|
.env('IMMICH_AUTO_CREATE_ALBUM')
|
|
.default(false),
|
|
)
|
|
.addOption(
|
|
new Option('-n, --dry-run', "Don't perform any actions, just show what will be done")
|
|
.env('IMMICH_DRY_RUN')
|
|
.default(false),
|
|
)
|
|
.addOption(new Option('--delete', 'Delete local assets after upload').env('IMMICH_DELETE_ASSETS'))
|
|
.argument('[paths...]', 'One or more paths to assets to be uploaded')
|
|
.action(async (paths, options) => {
|
|
options.exclusionPatterns = options.ignore;
|
|
await new Upload().run(paths, options);
|
|
});
|
|
|
|
program
|
|
.command('server-info')
|
|
.description('Display server information')
|
|
.action(async () => {
|
|
await new ServerInfo().run();
|
|
});
|
|
|
|
program
|
|
.command('login-key')
|
|
.description('Login using an API key')
|
|
.argument('[instanceUrl]')
|
|
.argument('[apiKey]')
|
|
.action(async (paths, options) => {
|
|
await new LoginKey().run(paths, options);
|
|
});
|
|
|
|
program
|
|
.command('logout')
|
|
.description('Remove stored credentials')
|
|
.action(async () => {
|
|
await new Logout().run();
|
|
});
|
|
|
|
program.parse(process.argv);
|