Skip to content

Commit fdd6325

Browse files
committed
Adjusting to init & push commands
1 parent d2bc68a commit fdd6325

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

templates/cli/lib/commands/pull.js.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,13 @@ const pullTeam = async () => {
238238
success();
239239
}
240240

241-
const initMessagingTopic = async () => {
241+
const pullMessagingTopic = async () => {
242242
const { topics } = await paginate(messagingListTopics, { parseOutput: false }, 100, 'topics');
243243

244244
log(`Found ${topics.length} topics`);
245245

246246
topics.forEach(async topic => {
247-
log(`Fetching ${topic.name} ...`);
247+
log(`Pulling ${topic.name} ...`);
248248
localConfig.addMessagingTopic(topic);
249249
});
250250

@@ -278,10 +278,10 @@ pull
278278
.description("Pulling your Appwrite teams")
279279
.action(actionRunner(pullTeam))
280280

281-
init
281+
pull
282282
.command("topic")
283283
.description("Initialise your Appwrite messaging topics")
284-
.action(actionRunner(initMessagingTopic))
284+
.action(actionRunner(pullMessagingTopic))
285285

286286
module.exports = {
287287
pull,

templates/cli/lib/commands/push.js.twig

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const JSONbig = require("json-bigint")({ storeAsString: false });
33
const { Command } = require("commander");
44
const { localConfig } = require("../config");
55
const { paginate } = require('../paginate');
6-
const { questionsPushBuckets, questionsPushTeams, questionsPushFunctions, questionsGetEntrypoint, questionsPushCollections, questionsConfirmPushCollections, questionsDeployMessagingTopics } = require("../questions");
6+
const { questionsPushBuckets, questionsPushTeams, questionsPushFunctions, questionsGetEntrypoint, questionsPushCollections, questionsConfirmPushCollections, questionsPushMessagingTopics } = require("../questions");
77
const { actionRunner, success, log, error, commandDescriptions } = require("../parser");
88
const { functionsGet, functionsCreate, functionsUpdate, functionsCreateDeployment, functionsUpdateDeployment, functionsListVariables, functionsDeleteVariable, functionsCreateVariable } = require('./functions');
99
const {
@@ -910,21 +910,21 @@ const pushTeam = async ({ all, yes } = {}) => {
910910
}
911911
}
912912

913-
const deployMessagingTopic = async ({ all, yes } = {}) => {
913+
const pushMessagingTopic = async ({ all, yes } = {}) => {
914914
let response = {};
915915

916916
let topicsIds = [];
917917
const configTopics = localConfig.getMessagingTopics();
918918

919919
if (all) {
920920
if (configTopics.length === 0) {
921-
throw new Error("No topics found in the current directory. Run `appwrite init topics` to fetch all your messaging topics.");
921+
throw new Error("No topics found in the current directory. Run `appwrite pull topics` to pull all your messaging topics.");
922922
}
923923
topicsIds.push(...configTopics.map((b) => b.$id));
924924
}
925925

926926
if (topicsIds.length === 0) {
927-
const answers = await inquirer.prompt(questionsDeployMessagingTopics[0])
927+
const answers = await inquirer.prompt(questionsPushMessagingTopics[0])
928928
topicsIds.push(...answers.topics);
929929
}
930930

@@ -936,7 +936,7 @@ const deployMessagingTopic = async ({ all, yes } = {}) => {
936936
}
937937

938938
for (let topic of topics) {
939-
log(`Deploying topic ${topic.name} ( ${topic['$id']} )`)
939+
log(`Pushing topic ${topic.name} ( ${topic['$id']} )`)
940940

941941
try {
942942
response = await messagingGetTopic({
@@ -946,7 +946,7 @@ const deployMessagingTopic = async ({ all, yes } = {}) => {
946946
log(`Topic ${topic.name} ( ${topic['$id']} ) already exists.`);
947947

948948
if (!yes) {
949-
const answers = await inquirer.prompt(questionsDeployMessagingTopics[1])
949+
const answers = await inquirer.prompt(questionsPushMessagingTopics[1])
950950
if (answers.override.toLowerCase() !== "yes") {
951951
log(`Received "${answers.override}". Skipping ${topic.name} ( ${topic['$id']} )`);
952952
continue;
@@ -962,7 +962,7 @@ const deployMessagingTopic = async ({ all, yes } = {}) => {
962962
parseOutput: false
963963
});
964964

965-
success(`Deployed ${topic.name} ( ${topic['$id']} )`);
965+
success(`Pushed ${topic.name} ( ${topic['$id']} )`);
966966
} catch (e) {
967967
if (e.code == 404) {
968968
log(`Topic ${topic.name} does not exist in the project. Creating ... `);
@@ -974,7 +974,7 @@ const deployMessagingTopic = async ({ all, yes } = {}) => {
974974
parseOutput: false
975975
})
976976

977-
success(`Deployed ${topic.name} ( ${topic['$id']} )`);
977+
success(`Pushed ${topic.name} ( ${topic['$id']} )`);
978978
} else {
979979
throw e;
980980
}
@@ -1011,12 +1011,12 @@ push
10111011
.option(`--yes`, `Flag to confirm all warnings`)
10121012
.action(actionRunner(pushTeam));
10131013

1014-
deploy
1014+
push
10151015
.command("topic")
1016-
.description("Deploy messaging topics in the current project.")
1016+
.description("Push messaging topics in the current project.")
10171017
.option(`--all`, `Flag to deploy all topics`)
10181018
.option(`--yes`, `Flag to confirm all warnings`)
1019-
.action(actionRunner(deployMessagingTopic));
1019+
.action(actionRunner(pushMessagingTopic));
10201020

10211021
module.exports = {
10221022
push

templates/cli/lib/questions.js.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,15 +356,15 @@ const questionsPushBuckets = [
356356
},
357357
]
358358

359-
const questionsDeployMessagingTopics = [
359+
const questionsPushMessagingTopics = [
360360
{
361361
type: "checkbox",
362362
name: "topics",
363-
message: "Which messaging topic would you like to deploy?",
363+
message: "Which messaging topic would you like to push?",
364364
choices: () => {
365365
let topics = localConfig.getMessagingTopics();
366366
if (topics.length === 0) {
367-
throw new Error("No topics found in the current directory. Run `appwrite init messaging` to fetch all your messaging topics.");
367+
throw new Error("No topics found in the current directory. Run `appwrite pull messaging` to fetch all your messaging topics.");
368368
}
369369
return topics.map(topic => {
370370
return {
@@ -480,7 +480,7 @@ module.exports = {
480480
questionsPushFunctions,
481481
questionsPushCollections,
482482
questionsPushBuckets,
483-
questionsDeployMessagingTopics,
483+
questionsPushMessagingTopics,
484484
questionsPushTeams,
485485
questionsGetEntrypoint,
486486
questionsListFactors,

0 commit comments

Comments
 (0)