-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcli.ts
executable file
·45 lines (40 loc) · 1.49 KB
/
cli.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env node
import { Command, Option } from 'commander';
import pull from './src/commands/pull';
import push from './src/commands/push';
import status from './src/commands/status';
import { version } from './package.json';
import { handleAsyncErrors } from './src/util/handleAsyncErrors';
const program = new Command('loco-cli')
.version(version)
.option('-a, --access-key <key>', 'Loco API token')
.option('-d, --locales-dir <path>', 'The folder in which the translations are stored.', '.')
.option('-N, --namespaces', 'Organize translations into namespaces', false);
program
.command('pull')
.option('-y, --yes', 'Answer yes to all confirmation prompts', false)
.description('Fetch assets from Loco')
.action(handleAsyncErrors(pull));
program
.command('push')
.option(
'-t, --tag [tag]',
'The tag option is removed in v2, use the `push.tag-new` option in `loco.config.js` instead'
)
.option(
'-s, --status [status]',
'The status option is removed in v2, use the `push.flag-new` option in `loco.config.js` instead'
)
.option('-y, --yes', 'Answer yes to all confirmation prompts', false)
.description('Upload assets to Loco')
.action(handleAsyncErrors(push));
program
.command('status')
.addOption(
new Option('--direction [direction]', 'Direction to diff the assets IDs to')
.choices(['remote', 'local', 'both'])
.default('both')
)
.description('Check status of local file')
.action(handleAsyncErrors(status));
program.parse(process.argv);