@@ -11,21 +11,21 @@ const { storageListBuckets } = require("./storage");
11
11
const { sdkForConsole } = require("../sdks");
12
12
const { localConfig } = require("../config");
13
13
const { paginate } = require("../paginate");
14
- const { questionsInitProject, questionsInitFunction, questionsInitCollection } = require("../questions");
14
+ const { questionsPullProject, questionsPullFunction, questionsPullCollection } = require("../questions");
15
15
const { success, log, actionRunner, commandDescriptions } = require("../parser");
16
16
17
- const init = new Command("init ")
18
- .description(commandDescriptions['init '])
17
+ const pull = new Command("pull ")
18
+ .description(commandDescriptions['pull '])
19
19
.configureHelp({
20
20
helpWidth: process.stdout.columns || 80
21
21
})
22
22
.action(actionRunner(async (_options, command) => {
23
23
command.help();
24
24
}));
25
25
26
- const initProject = async () => {
26
+ const pullProject = async () => {
27
27
let response = {}
28
- const answers = await inquirer.prompt(questionsInitProject )
28
+ const answers = await inquirer.prompt(questionsPullProject )
29
29
if (!answers.project) process.exit(1)
30
30
31
31
let sdk = await sdkForConsole();
@@ -52,9 +52,9 @@ const initProject = async () => {
52
52
success();
53
53
}
54
54
55
- const initFunction = async () => {
55
+ const pullFunction = async () => {
56
56
// TODO: Add CI/CD support (ID, name, runtime)
57
- const answers = await inquirer.prompt(questionsInitFunction )
57
+ const answers = await inquirer.prompt(questionsPullFunction )
58
58
const functionFolder = path.join(process.cwd(), 'functions');
59
59
60
60
if (!fs.existsSync(functionFolder)) {
@@ -70,11 +70,11 @@ const initFunction = async () => {
70
70
}
71
71
72
72
if (!answers.runtime.entrypoint) {
73
- log(`Entrypoint for this runtime not found. You will be asked to configure entrypoint when you first deploy the function.`);
73
+ log(`Entrypoint for this runtime not found. You will be asked to configure entrypoint when you first push the function.`);
74
74
}
75
75
76
76
if (!answers.runtime.commands) {
77
- log(`Installation command for this runtime not found. You will be asked to configure the install command when you first deploy the function.`);
77
+ log(`Installation command for this runtime not found. You will be asked to configure the install command when you first push the function.`);
78
78
}
79
79
80
80
let response = await functionsCreate({
@@ -161,7 +161,7 @@ const initFunction = async () => {
161
161
success();
162
162
}
163
163
164
- const initCollection = async ({ all, databaseId } = {}) => {
164
+ const pullCollection = async ({ all, databaseId } = {}) => {
165
165
const databaseIds = [];
166
166
167
167
if (databaseId) {
@@ -175,7 +175,7 @@ const initCollection = async ({ all, databaseId } = {}) => {
175
175
}
176
176
177
177
if (databaseIds.length < = 0) {
178
- let answers = await inquirer.prompt(questionsInitCollection )
178
+ let answers = await inquirer.prompt(questionsPullCollection )
179
179
if (!answers.databases) process.exit(1)
180
180
databaseIds.push(...answers.databases);
181
181
}
@@ -208,7 +208,7 @@ const initCollection = async ({ all, databaseId } = {}) => {
208
208
success();
209
209
}
210
210
211
- const initBucket = async () => {
211
+ const pullBucket = async () => {
212
212
const { buckets } = await paginate(storageListBuckets, { parseOutput: false }, 100, 'buckets');
213
213
214
214
log(`Found ${buckets.length} buckets`);
@@ -221,7 +221,7 @@ const initBucket = async () => {
221
221
success();
222
222
}
223
223
224
- const initTeam = async () => {
224
+ const pullTeam = async () => {
225
225
const { teams } = await paginate(teamsList, { parseOutput: false }, 100, 'teams');
226
226
227
227
log(`Found ${teams.length} teams`);
@@ -235,33 +235,33 @@ const initTeam = async () => {
235
235
success();
236
236
}
237
237
238
- init
238
+ pull
239
239
.command("project")
240
- .description("Initialise your {{ spec .title | caseUcfirst }} project")
241
- .action(actionRunner(initProject ));
240
+ .description("Pulling your {{ spec .title | caseUcfirst }} project")
241
+ .action(actionRunner(pullProject ));
242
242
243
- init
243
+ pull
244
244
.command("function")
245
- .description("Initialise your {{ spec .title | caseUcfirst }} cloud function")
246
- .action(actionRunner(initFunction ))
245
+ .description("Pulling your {{ spec .title | caseUcfirst }} cloud function")
246
+ .action(actionRunner(pullFunction ))
247
247
248
- init
248
+ pull
249
249
.command("collection")
250
- .description("Initialise your {{ spec .title | caseUcfirst }} collections")
250
+ .description("Pulling your {{ spec .title | caseUcfirst }} collections")
251
251
.option(`--databaseId <databaseId >`, `Database ID`)
252
- .option(`--all`, `Flag to initialize all databases`)
253
- .action(actionRunner(initCollection ))
252
+ .option(`--all`, `Flag to pullialize all databases`)
253
+ .action(actionRunner(pullCollection ))
254
254
255
- init
255
+ pull
256
256
.command("bucket")
257
- .description("Initialise your Appwrite buckets")
258
- .action(actionRunner(initBucket ))
257
+ .description("Pulling your Appwrite buckets")
258
+ .action(actionRunner(pullBucket ))
259
259
260
- init
260
+ pull
261
261
.command("team")
262
- .description("Initialise your Appwrite teams")
263
- .action(actionRunner(initTeam ))
262
+ .description("Pulling your Appwrite teams")
263
+ .action(actionRunner(pullTeam ))
264
264
265
265
module.exports = {
266
- init ,
266
+ pull ,
267
267
};
0 commit comments