contensis-cli 1.0.0-beta.53 → 1.0.0-beta.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/launch.json +15 -15
- package/README.md +1226 -1226
- package/dist/commands/connect.js.map +1 -1
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/diff.js.map +1 -1
- package/dist/commands/get.js.map +1 -1
- package/dist/commands/globalOptions.js.map +1 -1
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/release.js.map +1 -1
- package/dist/commands/remove.js.map +1 -1
- package/dist/commands/set.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/localisation/en-GB.js.map +1 -1
- package/dist/providers/CredentialProvider.js.map +1 -1
- package/dist/providers/SessionCacheProvider.js.map +1 -1
- package/dist/providers/file-provider.js.map +1 -1
- package/dist/services/ContensisAuthService.js.map +1 -1
- package/dist/services/ContensisCliService.js +4 -0
- package/dist/services/ContensisCliService.js.map +2 -2
- package/dist/shell.js.map +1 -1
- package/dist/util/console.printer.js +5 -5
- package/dist/util/console.printer.js.map +2 -2
- package/dist/util/csv.formatter.js.map +1 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/json.formatter.js.map +1 -1
- package/dist/util/logger.js.map +1 -1
- package/dist/util/xml.formatter.js.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/esbuild.config.js +49 -49
- package/headless-setup.sh +6 -6
- package/package.json +59 -59
- package/src/commands/connect.ts +24 -24
- package/src/commands/create.ts +70 -70
- package/src/commands/diff.ts +41 -41
- package/src/commands/get.ts +214 -214
- package/src/commands/globalOptions.ts +127 -127
- package/src/commands/import.ts +128 -128
- package/src/commands/index.ts +80 -80
- package/src/commands/list.ts +116 -116
- package/src/commands/login.ts +34 -34
- package/src/commands/push.ts +127 -127
- package/src/commands/release.ts +32 -32
- package/src/commands/remove.ts +85 -85
- package/src/commands/set.ts +96 -96
- package/src/index.ts +19 -19
- package/src/localisation/en-GB.ts +289 -289
- package/src/models/AppError.d.ts +40 -40
- package/src/models/Cache.d.ts +25 -25
- package/src/models/JsModules.d.ts +1 -1
- package/src/providers/CredentialProvider.ts +121 -121
- package/src/providers/SessionCacheProvider.ts +101 -101
- package/src/providers/file-provider.ts +76 -76
- package/src/services/ContensisAuthService.ts +70 -70
- package/src/services/ContensisCliService.ts +1749 -1745
- package/src/shell.ts +270 -270
- package/src/util/console.printer.ts +371 -371
- package/src/util/csv.formatter.ts +21 -21
- package/src/util/index.ts +73 -73
- package/src/util/json.formatter.ts +1 -1
- package/src/util/logger.ts +234 -234
- package/src/util/xml.formatter.ts +20 -20
- package/src/version.ts +1 -1
- package/tsconfig.json +22 -22
package/src/commands/create.ts
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { Project } from 'contensis-core-api';
|
|
3
|
-
import { cliCommand } from '~/services/ContensisCliService';
|
|
4
|
-
import { shell } from '~/shell';
|
|
5
|
-
|
|
6
|
-
export const makeCreateCommand = () => {
|
|
7
|
-
const create = new Command()
|
|
8
|
-
.command('create')
|
|
9
|
-
.description('create command')
|
|
10
|
-
.addHelpText('after', `\n`)
|
|
11
|
-
.showHelpAfterError(true)
|
|
12
|
-
.exitOverride();
|
|
13
|
-
|
|
14
|
-
create
|
|
15
|
-
.command('project')
|
|
16
|
-
.description('create a new project')
|
|
17
|
-
.argument('<projectId>', 'the id of the project to create')
|
|
18
|
-
.argument('<name>', 'the name of the project to create')
|
|
19
|
-
.argument('[description]', 'optional description of the project')
|
|
20
|
-
.option(
|
|
21
|
-
'-l, --language',
|
|
22
|
-
'the default language of the project to create',
|
|
23
|
-
'en-GB'
|
|
24
|
-
)
|
|
25
|
-
.option(
|
|
26
|
-
'-langs, --supported-languages <langs...>',
|
|
27
|
-
'space separated list of other supported languages'
|
|
28
|
-
)
|
|
29
|
-
.usage(
|
|
30
|
-
'projectId "Project name" ["Description of project"] --language en-GB --supported-languages es-ES de-DE nl-NL'
|
|
31
|
-
)
|
|
32
|
-
.addHelpText('after', `\n`)
|
|
33
|
-
.action(
|
|
34
|
-
async (projectId: string, name: string, description = '', opts: any) => {
|
|
35
|
-
const createProject: Project = {
|
|
36
|
-
id: projectId,
|
|
37
|
-
name,
|
|
38
|
-
description,
|
|
39
|
-
primaryLanguage: opts.language,
|
|
40
|
-
supportedLanguages: opts.supportedLanguages || [],
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const project = await cliCommand(
|
|
44
|
-
['create', 'project', projectId],
|
|
45
|
-
opts
|
|
46
|
-
).CreateProject(createProject);
|
|
47
|
-
if (project) await shell().restart();
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
create
|
|
51
|
-
.command('key')
|
|
52
|
-
.description('create a new api key')
|
|
53
|
-
.argument('<"key name">', 'the name of the key to create')
|
|
54
|
-
.argument('["description"]', 'provide a description for the key (optional)')
|
|
55
|
-
.usage('<"key name"> ["description"] (both args in "double quotes")')
|
|
56
|
-
.addHelpText(
|
|
57
|
-
'after',
|
|
58
|
-
`
|
|
59
|
-
Example call:
|
|
60
|
-
> create key "my new key" "Created key for demonstration"\n`
|
|
61
|
-
)
|
|
62
|
-
.action(async (name: string, description: string, opts: any) => {
|
|
63
|
-
await cliCommand(['create', 'key', name], opts).CreateApiKey(
|
|
64
|
-
name,
|
|
65
|
-
description
|
|
66
|
-
);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
return create;
|
|
70
|
-
};
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { Project } from 'contensis-core-api';
|
|
3
|
+
import { cliCommand } from '~/services/ContensisCliService';
|
|
4
|
+
import { shell } from '~/shell';
|
|
5
|
+
|
|
6
|
+
export const makeCreateCommand = () => {
|
|
7
|
+
const create = new Command()
|
|
8
|
+
.command('create')
|
|
9
|
+
.description('create command')
|
|
10
|
+
.addHelpText('after', `\n`)
|
|
11
|
+
.showHelpAfterError(true)
|
|
12
|
+
.exitOverride();
|
|
13
|
+
|
|
14
|
+
create
|
|
15
|
+
.command('project')
|
|
16
|
+
.description('create a new project')
|
|
17
|
+
.argument('<projectId>', 'the id of the project to create')
|
|
18
|
+
.argument('<name>', 'the name of the project to create')
|
|
19
|
+
.argument('[description]', 'optional description of the project')
|
|
20
|
+
.option(
|
|
21
|
+
'-l, --language',
|
|
22
|
+
'the default language of the project to create',
|
|
23
|
+
'en-GB'
|
|
24
|
+
)
|
|
25
|
+
.option(
|
|
26
|
+
'-langs, --supported-languages <langs...>',
|
|
27
|
+
'space separated list of other supported languages'
|
|
28
|
+
)
|
|
29
|
+
.usage(
|
|
30
|
+
'projectId "Project name" ["Description of project"] --language en-GB --supported-languages es-ES de-DE nl-NL'
|
|
31
|
+
)
|
|
32
|
+
.addHelpText('after', `\n`)
|
|
33
|
+
.action(
|
|
34
|
+
async (projectId: string, name: string, description = '', opts: any) => {
|
|
35
|
+
const createProject: Project = {
|
|
36
|
+
id: projectId,
|
|
37
|
+
name,
|
|
38
|
+
description,
|
|
39
|
+
primaryLanguage: opts.language,
|
|
40
|
+
supportedLanguages: opts.supportedLanguages || [],
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const project = await cliCommand(
|
|
44
|
+
['create', 'project', projectId],
|
|
45
|
+
opts
|
|
46
|
+
).CreateProject(createProject);
|
|
47
|
+
if (project) await shell().restart();
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
create
|
|
51
|
+
.command('key')
|
|
52
|
+
.description('create a new api key')
|
|
53
|
+
.argument('<"key name">', 'the name of the key to create')
|
|
54
|
+
.argument('["description"]', 'provide a description for the key (optional)')
|
|
55
|
+
.usage('<"key name"> ["description"] (both args in "double quotes")')
|
|
56
|
+
.addHelpText(
|
|
57
|
+
'after',
|
|
58
|
+
`
|
|
59
|
+
Example call:
|
|
60
|
+
> create key "my new key" "Created key for demonstration"\n`
|
|
61
|
+
)
|
|
62
|
+
.action(async (name: string, description: string, opts: any) => {
|
|
63
|
+
await cliCommand(['create', 'key', name], opts).CreateApiKey(
|
|
64
|
+
name,
|
|
65
|
+
description
|
|
66
|
+
);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
return create;
|
|
70
|
+
};
|
package/src/commands/diff.ts
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { cliCommand } from '~/services/ContensisCliService';
|
|
3
|
-
import { mapContensisOpts } from './globalOptions';
|
|
4
|
-
|
|
5
|
-
export const makeDiffCommand = () => {
|
|
6
|
-
const release = new Command()
|
|
7
|
-
.command('diff')
|
|
8
|
-
.description('diff command')
|
|
9
|
-
.addHelpText('after', `\n`)
|
|
10
|
-
.showHelpAfterError(true)
|
|
11
|
-
.exitOverride();
|
|
12
|
-
|
|
13
|
-
release
|
|
14
|
-
.command('models')
|
|
15
|
-
.description('differences with content models')
|
|
16
|
-
.argument(
|
|
17
|
-
'[model-ids...]',
|
|
18
|
-
'ids of any content types or components to diff (optional)'
|
|
19
|
-
)
|
|
20
|
-
.usage('[model-ids...]')
|
|
21
|
-
.addHelpText(
|
|
22
|
-
'after',
|
|
23
|
-
`
|
|
24
|
-
Example call:
|
|
25
|
-
> diff models blogPost\n`
|
|
26
|
-
)
|
|
27
|
-
.action(async (modelIds: string[] = [], opts) => {
|
|
28
|
-
await cliCommand(
|
|
29
|
-
['diff', 'models', modelIds.join(' ')],
|
|
30
|
-
opts,
|
|
31
|
-
mapContensisOpts({ modelIds, ...opts })
|
|
32
|
-
).DiffModels(
|
|
33
|
-
{
|
|
34
|
-
...opts,
|
|
35
|
-
},
|
|
36
|
-
modelIds
|
|
37
|
-
);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
return release;
|
|
41
|
-
};
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { cliCommand } from '~/services/ContensisCliService';
|
|
3
|
+
import { mapContensisOpts } from './globalOptions';
|
|
4
|
+
|
|
5
|
+
export const makeDiffCommand = () => {
|
|
6
|
+
const release = new Command()
|
|
7
|
+
.command('diff')
|
|
8
|
+
.description('diff command')
|
|
9
|
+
.addHelpText('after', `\n`)
|
|
10
|
+
.showHelpAfterError(true)
|
|
11
|
+
.exitOverride();
|
|
12
|
+
|
|
13
|
+
release
|
|
14
|
+
.command('models')
|
|
15
|
+
.description('differences with content models')
|
|
16
|
+
.argument(
|
|
17
|
+
'[model-ids...]',
|
|
18
|
+
'ids of any content types or components to diff (optional)'
|
|
19
|
+
)
|
|
20
|
+
.usage('[model-ids...]')
|
|
21
|
+
.addHelpText(
|
|
22
|
+
'after',
|
|
23
|
+
`
|
|
24
|
+
Example call:
|
|
25
|
+
> diff models blogPost\n`
|
|
26
|
+
)
|
|
27
|
+
.action(async (modelIds: string[] = [], opts) => {
|
|
28
|
+
await cliCommand(
|
|
29
|
+
['diff', 'models', modelIds.join(' ')],
|
|
30
|
+
opts,
|
|
31
|
+
mapContensisOpts({ modelIds, ...opts })
|
|
32
|
+
).DiffModels(
|
|
33
|
+
{
|
|
34
|
+
...opts,
|
|
35
|
+
},
|
|
36
|
+
modelIds
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return release;
|
|
41
|
+
};
|
package/src/commands/get.ts
CHANGED
|
@@ -1,214 +1,214 @@
|
|
|
1
|
-
import { Argument, Command } from 'commander';
|
|
2
|
-
import { cliCommand } from '~/services/ContensisCliService';
|
|
3
|
-
import { mapContensisOpts } from './globalOptions';
|
|
4
|
-
|
|
5
|
-
export const makeGetCommand = () => {
|
|
6
|
-
const program = new Command()
|
|
7
|
-
.command('get')
|
|
8
|
-
.addHelpText('after', `\n`)
|
|
9
|
-
.showHelpAfterError(true)
|
|
10
|
-
.exitOverride();
|
|
11
|
-
|
|
12
|
-
program
|
|
13
|
-
.command('version')
|
|
14
|
-
.description('get current Contensis version')
|
|
15
|
-
.addHelpText(
|
|
16
|
-
'after',
|
|
17
|
-
`
|
|
18
|
-
Example call:
|
|
19
|
-
> version
|
|
20
|
-
`
|
|
21
|
-
)
|
|
22
|
-
.action(async opts => {
|
|
23
|
-
await cliCommand(['get', 'version'], opts).PrintContensisVersion();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
program
|
|
27
|
-
.command('project')
|
|
28
|
-
.description('get a project')
|
|
29
|
-
.argument('[projectId]', 'id of the project to get (default: current)')
|
|
30
|
-
.addHelpText(
|
|
31
|
-
'after',
|
|
32
|
-
`
|
|
33
|
-
Example call:
|
|
34
|
-
> get project website
|
|
35
|
-
`
|
|
36
|
-
)
|
|
37
|
-
.action(async (projectId: string, opts) => {
|
|
38
|
-
await cliCommand(['get', 'project', projectId], opts).PrintProject(
|
|
39
|
-
projectId
|
|
40
|
-
);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
program
|
|
44
|
-
.command('model')
|
|
45
|
-
.description('get a content model')
|
|
46
|
-
.argument('<contentTypeId...>', 'ids of the content models to get')
|
|
47
|
-
.addHelpText(
|
|
48
|
-
'after',
|
|
49
|
-
`
|
|
50
|
-
Example call:
|
|
51
|
-
> get model podcast podcastLinks
|
|
52
|
-
`
|
|
53
|
-
)
|
|
54
|
-
.action(async (modelIds: string[], opts) => {
|
|
55
|
-
await cliCommand(
|
|
56
|
-
['get', 'model', modelIds.join(' ')],
|
|
57
|
-
opts
|
|
58
|
-
).PrintContentModels(modelIds);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
program
|
|
62
|
-
.command('contenttype')
|
|
63
|
-
.description('get a content type')
|
|
64
|
-
.argument('<contentTypeId>', 'the API id of the content type to get')
|
|
65
|
-
.addHelpText(
|
|
66
|
-
'after',
|
|
67
|
-
`
|
|
68
|
-
Example call:
|
|
69
|
-
> get contenttype {contentTypeId} -o content-type-backup.json
|
|
70
|
-
`
|
|
71
|
-
)
|
|
72
|
-
.action(async (contentTypeId: string, opts) => {
|
|
73
|
-
await cliCommand(
|
|
74
|
-
['get', 'contenttype', contentTypeId],
|
|
75
|
-
opts
|
|
76
|
-
).PrintContentType(contentTypeId);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
program
|
|
80
|
-
.command('component')
|
|
81
|
-
.description('get a component')
|
|
82
|
-
.argument('<componentId>', 'the API id of the component to get')
|
|
83
|
-
.addHelpText(
|
|
84
|
-
'after',
|
|
85
|
-
`
|
|
86
|
-
Example call:
|
|
87
|
-
> get component {componentId} -o component-backup.json
|
|
88
|
-
`
|
|
89
|
-
)
|
|
90
|
-
.action(async (componentId: string, opts) => {
|
|
91
|
-
await cliCommand(['get', 'component', componentId], opts).PrintComponent(
|
|
92
|
-
componentId
|
|
93
|
-
);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
program
|
|
97
|
-
.command('entries')
|
|
98
|
-
.description('get entries')
|
|
99
|
-
.argument(
|
|
100
|
-
'[search phrase]',
|
|
101
|
-
'get entries with the search phrase, use quotes for multiple words'
|
|
102
|
-
)
|
|
103
|
-
.option('-i --id <id...>', 'the entry id(s) to get')
|
|
104
|
-
.option(
|
|
105
|
-
'-d, --dependents',
|
|
106
|
-
'find and return any dependencies of all found entries'
|
|
107
|
-
)
|
|
108
|
-
.option(
|
|
109
|
-
'-fi, --fields <fields...>',
|
|
110
|
-
'limit the output fields on returned entries'
|
|
111
|
-
)
|
|
112
|
-
.option(
|
|
113
|
-
'-q, --zenql <zenql>',
|
|
114
|
-
'get entries with a supplied ZenQL statement'
|
|
115
|
-
)
|
|
116
|
-
.addHelpText(
|
|
117
|
-
'after',
|
|
118
|
-
`
|
|
119
|
-
Example call:
|
|
120
|
-
> get entries --zenql "sys.contentTypeId = blog" --fields entryTitle entryDescription sys.id --output ./blog-posts.csv --format csv
|
|
121
|
-
`
|
|
122
|
-
)
|
|
123
|
-
.action(async (phrase: string, opts, cmd) => {
|
|
124
|
-
// console.log('phrase: ', phrase, '\nopts:', JSON.stringify(opts, null, 2));
|
|
125
|
-
// console.log('opts:', JSON.stringify(opts, null, 2));
|
|
126
|
-
await cliCommand(
|
|
127
|
-
['get', 'entries'],
|
|
128
|
-
opts,
|
|
129
|
-
mapContensisOpts({ phrase, ...opts })
|
|
130
|
-
).GetEntries({
|
|
131
|
-
withDependents: opts.dependents,
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
const block = program
|
|
136
|
-
.command('block')
|
|
137
|
-
.description('get a block or block version')
|
|
138
|
-
.argument('[blockId]', 'the block to get version details for')
|
|
139
|
-
.argument(
|
|
140
|
-
'[branch]',
|
|
141
|
-
'the branch of the block to get version details for',
|
|
142
|
-
'main'
|
|
143
|
-
)
|
|
144
|
-
.argument(
|
|
145
|
-
'[version]',
|
|
146
|
-
'get a specific version of the block pushed to the specified branch'
|
|
147
|
-
)
|
|
148
|
-
.addHelpText(
|
|
149
|
-
'after',
|
|
150
|
-
`
|
|
151
|
-
Example call:
|
|
152
|
-
> get block contensis-website master latest
|
|
153
|
-
`
|
|
154
|
-
)
|
|
155
|
-
.action(async (blockId: string, branch: string, version: string, opts) => {
|
|
156
|
-
await cliCommand(['get', 'block'], opts).PrintBlockVersions(
|
|
157
|
-
blockId,
|
|
158
|
-
branch,
|
|
159
|
-
version
|
|
160
|
-
);
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
const dataCenter = new Argument(
|
|
164
|
-
'[dataCenter]',
|
|
165
|
-
'the datacentre of the block to get logs for'
|
|
166
|
-
)
|
|
167
|
-
.choices(['hq', 'london', 'manchester'])
|
|
168
|
-
.default('hq');
|
|
169
|
-
|
|
170
|
-
block
|
|
171
|
-
.command('logs')
|
|
172
|
-
.description('get logs for a block')
|
|
173
|
-
.argument('[blockId]', 'the block to get version logs for')
|
|
174
|
-
.argument(
|
|
175
|
-
'[branch]',
|
|
176
|
-
'the branch of the block to get version details for',
|
|
177
|
-
'main'
|
|
178
|
-
)
|
|
179
|
-
.argument(
|
|
180
|
-
'[version]',
|
|
181
|
-
'the version of the block pushed to the branch to get logs for',
|
|
182
|
-
'latest'
|
|
183
|
-
)
|
|
184
|
-
.addArgument(dataCenter)
|
|
185
|
-
.usage('get block logs [blockId] [branch] [version] [dataCenter]')
|
|
186
|
-
.addHelpText(
|
|
187
|
-
'after',
|
|
188
|
-
`
|
|
189
|
-
Example call:
|
|
190
|
-
> get block logs contensis-website master
|
|
191
|
-
> get block logs contensis-website master latest london
|
|
192
|
-
`
|
|
193
|
-
)
|
|
194
|
-
.action(
|
|
195
|
-
async (
|
|
196
|
-
blockId: string,
|
|
197
|
-
branch: string,
|
|
198
|
-
version: string,
|
|
199
|
-
dataCenter: 'hq' | 'manchester' | 'london',
|
|
200
|
-
opts
|
|
201
|
-
) => {
|
|
202
|
-
await cliCommand(['get', 'block', 'logs'], opts).PrintBlockLogs(
|
|
203
|
-
blockId,
|
|
204
|
-
branch,
|
|
205
|
-
version,
|
|
206
|
-
dataCenter
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
);
|
|
210
|
-
|
|
211
|
-
return program;
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
export const get = makeGetCommand();
|
|
1
|
+
import { Argument, Command } from 'commander';
|
|
2
|
+
import { cliCommand } from '~/services/ContensisCliService';
|
|
3
|
+
import { mapContensisOpts } from './globalOptions';
|
|
4
|
+
|
|
5
|
+
export const makeGetCommand = () => {
|
|
6
|
+
const program = new Command()
|
|
7
|
+
.command('get')
|
|
8
|
+
.addHelpText('after', `\n`)
|
|
9
|
+
.showHelpAfterError(true)
|
|
10
|
+
.exitOverride();
|
|
11
|
+
|
|
12
|
+
program
|
|
13
|
+
.command('version')
|
|
14
|
+
.description('get current Contensis version')
|
|
15
|
+
.addHelpText(
|
|
16
|
+
'after',
|
|
17
|
+
`
|
|
18
|
+
Example call:
|
|
19
|
+
> version
|
|
20
|
+
`
|
|
21
|
+
)
|
|
22
|
+
.action(async opts => {
|
|
23
|
+
await cliCommand(['get', 'version'], opts).PrintContensisVersion();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
program
|
|
27
|
+
.command('project')
|
|
28
|
+
.description('get a project')
|
|
29
|
+
.argument('[projectId]', 'id of the project to get (default: current)')
|
|
30
|
+
.addHelpText(
|
|
31
|
+
'after',
|
|
32
|
+
`
|
|
33
|
+
Example call:
|
|
34
|
+
> get project website
|
|
35
|
+
`
|
|
36
|
+
)
|
|
37
|
+
.action(async (projectId: string, opts) => {
|
|
38
|
+
await cliCommand(['get', 'project', projectId], opts).PrintProject(
|
|
39
|
+
projectId
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
program
|
|
44
|
+
.command('model')
|
|
45
|
+
.description('get a content model')
|
|
46
|
+
.argument('<contentTypeId...>', 'ids of the content models to get')
|
|
47
|
+
.addHelpText(
|
|
48
|
+
'after',
|
|
49
|
+
`
|
|
50
|
+
Example call:
|
|
51
|
+
> get model podcast podcastLinks
|
|
52
|
+
`
|
|
53
|
+
)
|
|
54
|
+
.action(async (modelIds: string[], opts) => {
|
|
55
|
+
await cliCommand(
|
|
56
|
+
['get', 'model', modelIds.join(' ')],
|
|
57
|
+
opts
|
|
58
|
+
).PrintContentModels(modelIds);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
program
|
|
62
|
+
.command('contenttype')
|
|
63
|
+
.description('get a content type')
|
|
64
|
+
.argument('<contentTypeId>', 'the API id of the content type to get')
|
|
65
|
+
.addHelpText(
|
|
66
|
+
'after',
|
|
67
|
+
`
|
|
68
|
+
Example call:
|
|
69
|
+
> get contenttype {contentTypeId} -o content-type-backup.json
|
|
70
|
+
`
|
|
71
|
+
)
|
|
72
|
+
.action(async (contentTypeId: string, opts) => {
|
|
73
|
+
await cliCommand(
|
|
74
|
+
['get', 'contenttype', contentTypeId],
|
|
75
|
+
opts
|
|
76
|
+
).PrintContentType(contentTypeId);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
program
|
|
80
|
+
.command('component')
|
|
81
|
+
.description('get a component')
|
|
82
|
+
.argument('<componentId>', 'the API id of the component to get')
|
|
83
|
+
.addHelpText(
|
|
84
|
+
'after',
|
|
85
|
+
`
|
|
86
|
+
Example call:
|
|
87
|
+
> get component {componentId} -o component-backup.json
|
|
88
|
+
`
|
|
89
|
+
)
|
|
90
|
+
.action(async (componentId: string, opts) => {
|
|
91
|
+
await cliCommand(['get', 'component', componentId], opts).PrintComponent(
|
|
92
|
+
componentId
|
|
93
|
+
);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
program
|
|
97
|
+
.command('entries')
|
|
98
|
+
.description('get entries')
|
|
99
|
+
.argument(
|
|
100
|
+
'[search phrase]',
|
|
101
|
+
'get entries with the search phrase, use quotes for multiple words'
|
|
102
|
+
)
|
|
103
|
+
.option('-i --id <id...>', 'the entry id(s) to get')
|
|
104
|
+
.option(
|
|
105
|
+
'-d, --dependents',
|
|
106
|
+
'find and return any dependencies of all found entries'
|
|
107
|
+
)
|
|
108
|
+
.option(
|
|
109
|
+
'-fi, --fields <fields...>',
|
|
110
|
+
'limit the output fields on returned entries'
|
|
111
|
+
)
|
|
112
|
+
.option(
|
|
113
|
+
'-q, --zenql <zenql>',
|
|
114
|
+
'get entries with a supplied ZenQL statement'
|
|
115
|
+
)
|
|
116
|
+
.addHelpText(
|
|
117
|
+
'after',
|
|
118
|
+
`
|
|
119
|
+
Example call:
|
|
120
|
+
> get entries --zenql "sys.contentTypeId = blog" --fields entryTitle entryDescription sys.id --output ./blog-posts.csv --format csv
|
|
121
|
+
`
|
|
122
|
+
)
|
|
123
|
+
.action(async (phrase: string, opts, cmd) => {
|
|
124
|
+
// console.log('phrase: ', phrase, '\nopts:', JSON.stringify(opts, null, 2));
|
|
125
|
+
// console.log('opts:', JSON.stringify(opts, null, 2));
|
|
126
|
+
await cliCommand(
|
|
127
|
+
['get', 'entries'],
|
|
128
|
+
opts,
|
|
129
|
+
mapContensisOpts({ phrase, ...opts })
|
|
130
|
+
).GetEntries({
|
|
131
|
+
withDependents: opts.dependents,
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const block = program
|
|
136
|
+
.command('block')
|
|
137
|
+
.description('get a block or block version')
|
|
138
|
+
.argument('[blockId]', 'the block to get version details for')
|
|
139
|
+
.argument(
|
|
140
|
+
'[branch]',
|
|
141
|
+
'the branch of the block to get version details for',
|
|
142
|
+
'main'
|
|
143
|
+
)
|
|
144
|
+
.argument(
|
|
145
|
+
'[version]',
|
|
146
|
+
'get a specific version of the block pushed to the specified branch'
|
|
147
|
+
)
|
|
148
|
+
.addHelpText(
|
|
149
|
+
'after',
|
|
150
|
+
`
|
|
151
|
+
Example call:
|
|
152
|
+
> get block contensis-website master latest
|
|
153
|
+
`
|
|
154
|
+
)
|
|
155
|
+
.action(async (blockId: string, branch: string, version: string, opts) => {
|
|
156
|
+
await cliCommand(['get', 'block'], opts).PrintBlockVersions(
|
|
157
|
+
blockId,
|
|
158
|
+
branch,
|
|
159
|
+
version
|
|
160
|
+
);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
const dataCenter = new Argument(
|
|
164
|
+
'[dataCenter]',
|
|
165
|
+
'the datacentre of the block to get logs for'
|
|
166
|
+
)
|
|
167
|
+
.choices(['hq', 'london', 'manchester'])
|
|
168
|
+
.default('hq');
|
|
169
|
+
|
|
170
|
+
block
|
|
171
|
+
.command('logs')
|
|
172
|
+
.description('get logs for a block')
|
|
173
|
+
.argument('[blockId]', 'the block to get version logs for')
|
|
174
|
+
.argument(
|
|
175
|
+
'[branch]',
|
|
176
|
+
'the branch of the block to get version details for',
|
|
177
|
+
'main'
|
|
178
|
+
)
|
|
179
|
+
.argument(
|
|
180
|
+
'[version]',
|
|
181
|
+
'the version of the block pushed to the branch to get logs for',
|
|
182
|
+
'latest'
|
|
183
|
+
)
|
|
184
|
+
.addArgument(dataCenter)
|
|
185
|
+
.usage('get block logs [blockId] [branch] [version] [dataCenter]')
|
|
186
|
+
.addHelpText(
|
|
187
|
+
'after',
|
|
188
|
+
`
|
|
189
|
+
Example call:
|
|
190
|
+
> get block logs contensis-website master
|
|
191
|
+
> get block logs contensis-website master latest london
|
|
192
|
+
`
|
|
193
|
+
)
|
|
194
|
+
.action(
|
|
195
|
+
async (
|
|
196
|
+
blockId: string,
|
|
197
|
+
branch: string,
|
|
198
|
+
version: string,
|
|
199
|
+
dataCenter: 'hq' | 'manchester' | 'london',
|
|
200
|
+
opts
|
|
201
|
+
) => {
|
|
202
|
+
await cliCommand(['get', 'block', 'logs'], opts).PrintBlockLogs(
|
|
203
|
+
blockId,
|
|
204
|
+
branch,
|
|
205
|
+
version,
|
|
206
|
+
dataCenter
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
return program;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export const get = makeGetCommand();
|