-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathcommand.ts
More file actions
66 lines (61 loc) · 1.72 KB
/
Copy pathcommand.ts
File metadata and controls
66 lines (61 loc) · 1.72 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import yargs from 'yargs';
import { build, ensure, override } from '../util/command-builders';
import { Opts } from '../options';
import { Opts as POpts } from '../projects/options';
import * as o from '../options';
import * as po from '../projects/options';
export type PullOptions = Required<
Pick<
Opts & POpts,
| 'apiKey'
| 'beta'
| 'command'
| 'endpoint'
| 'log'
| 'logJson'
| 'statePath'
| 'projectPath'
| 'configPath'
| 'projectId'
| 'confirm'
| 'snapshots'
| 'workspace'
>
>;
const options = [
o.apiKey,
o.beta,
o.configPath,
o.endpoint,
po.env,
o.log,
override(o.path, {
description: 'path to output the project to',
}),
o.logJson,
o.projectPath,
o.snapshots,
o.statePath,
o.path,
// These are hidden commands used only by beta
// The need to be declared here to be initialised and defaulted properly
override(o.force, { hidden: true }),
override(po.workspace, { hidden: true }),
];
const pullCommand: yargs.CommandModule<PullOptions> = {
command: 'pull [projectId]',
describe: `Pull a project's state and spec from a Lightning Instance to the local directory. Pass --beta to use the experimental new pull command. See https://github.com/OpenFn/kit/wiki/Pull-Deploy-Beta for docs`,
builder: (yargs: yargs.Argv<PullOptions>) =>
build(options, yargs)
.positional('projectId', {
describe:
'The id of the project that should be pulled should be a UUID',
demandOption: true,
})
.example(
'pull 57862287-23e6-4650-8d79-e1dd88b24b1c',
'Pull an updated copy of a the above spec and state from a Lightning Instance'
),
handler: ensure('pull', options),
};
export default pullCommand;