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