Skip to content

Commit 31a7560

Browse files
committed
Merge branch 'refs/heads/feat-cli-g2' into feat-organization-support
2 parents ad30431 + 9276294 commit 31a7560

File tree

7 files changed

+122
-123
lines changed

7 files changed

+122
-123
lines changed

src/SDK/Language/CLI.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,13 @@ public function getFiles(): array
169169
],
170170
[
171171
'scope' => 'default',
172-
'destination' => 'lib/commands/init.js',
173-
'template' => 'cli/lib/commands/init.js.twig',
172+
'destination' => 'lib/commands/pull.js',
173+
'template' => 'cli/lib/commands/pull.js.twig',
174174
],
175175
[
176176
'scope' => 'default',
177-
'destination' => 'lib/commands/deploy.js',
178-
'template' => 'cli/lib/commands/deploy.js.twig',
177+
'destination' => 'lib/commands/push.js',
178+
'template' => 'cli/lib/commands/push.js.twig',
179179
],
180180
[
181181
'scope' => 'service',

templates/cli/index.js.twig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ const { commandDescriptions, cliConfig } = require("./lib/parser");
1212
const { client } = require("./lib/commands/generic");
1313
{% if sdk.test != "true" %}
1414
const { login, logout } = require("./lib/commands/generic");
15-
const { init } = require("./lib/commands/init");
16-
const { deploy } = require("./lib/commands/deploy");
15+
const { pull } = require("./lib/commands/pull");
16+
const { push } = require("./lib/commands/push");
1717
{% endif %}
1818
{% for service in spec.services %}
1919
const { {{ service.name | caseLower }} } = require("./lib/commands/{{ service.name | caseLower }}");
@@ -37,14 +37,14 @@ program
3737
.showSuggestionAfterError()
3838
{% if sdk.test != "true" %}
3939
.addCommand(login)
40-
.addCommand(init)
41-
.addCommand(deploy)
40+
.addCommand(pull)
41+
.addCommand(push)
4242
.addCommand(logout)
4343
{% endif %}
4444
{% for service in spec.services %}
4545
.addCommand({{ service.name | caseLower }})
4646
{% endfor %}
4747
.addCommand(client)
4848
.parse(process.argv);
49-
50-
process.stdout.columns = oldWidth;
49+
50+
process.stdout.columns = oldWidth;

templates/cli/lib/commands/init.js.twig renamed to templates/cli/lib/commands/pull.js.twig

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@ const { sdkForConsole } = require("../sdks");
1212
const { localConfig } = require("../config");
1313
const ID = require("../id");
1414
const { paginate } = require("../paginate");
15-
const { questionsInitProject, questionsInitFunction, questionsInitCollection } = require("../questions");
15+
const { questionsPullProject, questionsPullFunction, questionsPullCollection } = require("../questions");
1616
const { success, log, actionRunner, commandDescriptions } = require("../parser");
1717

18-
const init = new Command("init")
19-
.description(commandDescriptions['init'])
18+
const pull = new Command("pull")
19+
.description(commandDescriptions['pull'])
2020
.configureHelp({
2121
helpWidth: process.stdout.columns || 80
2222
})
2323
.action(actionRunner(async (_options, command) => {
2424
command.help();
2525
}));
2626

27-
const initProject = async () => {
27+
const pullProject = async () => {
2828
let response = {}
29-
const answers = await inquirer.prompt(questionsInitProject)
29+
const answers = await inquirer.prompt(questionsPullProject)
3030
if (!answers.project) process.exit(1)
3131

3232
let sdk = await sdkForConsole();
@@ -53,9 +53,9 @@ const initProject = async () => {
5353
success();
5454
}
5555

56-
const initFunction = async () => {
56+
const pullFunction = async () => {
5757
// TODO: Add CI/CD support (ID, name, runtime)
58-
const answers = await inquirer.prompt(questionsInitFunction)
58+
const answers = await inquirer.prompt(questionsPullFunction)
5959
const functionFolder = path.join(process.cwd(), 'functions');
6060

6161
if (!fs.existsSync(functionFolder)) {
@@ -72,11 +72,11 @@ const initFunction = async () => {
7272
}
7373

7474
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.`);
7676
}
7777

7878
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.`);
8080
}
8181

8282
let response = await functionsCreate({
@@ -163,7 +163,7 @@ const initFunction = async () => {
163163
success();
164164
}
165165

166-
const initCollection = async ({ all, databaseId } = {}) => {
166+
const pullCollection = async ({ all, databaseId } = {}) => {
167167
const databaseIds = [];
168168

169169
if (databaseId) {
@@ -177,7 +177,7 @@ const initCollection = async ({ all, databaseId } = {}) => {
177177
}
178178

179179
if (databaseIds.length <= 0) {
180-
let answers = await inquirer.prompt(questionsInitCollection)
180+
let answers = await inquirer.prompt(questionsPullCollection)
181181
if (!answers.databases) process.exit(1)
182182
databaseIds.push(...answers.databases);
183183
}
@@ -210,7 +210,7 @@ const initCollection = async ({ all, databaseId } = {}) => {
210210
success();
211211
}
212212

213-
const initBucket = async () => {
213+
const pullBucket = async () => {
214214
const { buckets } = await paginate(storageListBuckets, { parseOutput: false }, 100, 'buckets');
215215

216216
log(`Found ${buckets.length} buckets`);
@@ -223,7 +223,7 @@ const initBucket = async () => {
223223
success();
224224
}
225225

226-
const initTeam = async () => {
226+
const pullTeam = async () => {
227227
const { teams } = await paginate(teamsList, { parseOutput: false }, 100, 'teams');
228228

229229
log(`Found ${teams.length} teams`);
@@ -237,33 +237,33 @@ const initTeam = async () => {
237237
success();
238238
}
239239

240-
init
240+
pull
241241
.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));
244244

245-
init
245+
pull
246246
.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))
249249

250-
init
250+
pull
251251
.command("collection")
252-
.description("Initialise your {{ spec.title|caseUcfirst }} collections")
252+
.description("Pulling your {{ spec.title|caseUcfirst }} collections")
253253
.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))
256256

257-
init
257+
pull
258258
.command("bucket")
259-
.description("Initialise your Appwrite buckets")
260-
.action(actionRunner(initBucket))
259+
.description("Pulling your Appwrite buckets")
260+
.action(actionRunner(pullBucket))
261261

262-
init
262+
pull
263263
.command("team")
264-
.description("Initialise your Appwrite teams")
265-
.action(actionRunner(initTeam))
264+
.description("Pulling your Appwrite teams")
265+
.action(actionRunner(pullTeam))
266266

267267
module.exports = {
268-
init,
268+
pull,
269269
};

0 commit comments

Comments
 (0)