Skip to content

Commit

Permalink
Auto format CLI template
Browse files Browse the repository at this point in the history
  • Loading branch information
stnguyen90 committed Apr 6, 2023
1 parent 0c86a8a commit 9957188
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions templates/cli/lib/commands/init.js.twig
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const { success, log, actionRunner, commandDescriptions } = require("../parser")
const init = new Command("init")
.description(commandDescriptions['init'])
.configureHelp({
helpWidth: process.stdout.columns || 80
helpWidth: process.stdout.columns || 80
})
.action(actionRunner(async (_options, command) => {
command.help();
Expand Down Expand Up @@ -68,7 +68,7 @@ const initFunction = async () => {
throw new Error(`( ${answers.name} ) already exists in the current directory. Please choose another name.`);
}

if(!answers.runtime.entrypoint) {
if (!answers.runtime.entrypoint) {
log(`Entrypoint for this runtime not found. You will be asked to configure entrypoint when you first deploy the function.`);
}

Expand Down Expand Up @@ -116,7 +116,7 @@ const initFunction = async () => {
fs.mkdirSync(dest);
}

fs.readdirSync(src).forEach(function(childItemName) {
fs.readdirSync(src).forEach(function (childItemName) {
copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName));
});
} else {
Expand Down Expand Up @@ -154,23 +154,23 @@ const initFunction = async () => {
const initCollection = async ({ all, databaseId } = {}) => {
const databaseIds = [];

if(databaseId) {
if (databaseId) {
databaseIds.push(databaseId);
} else if(all) {
let allDatabases = await databasesList({
parseOutput: false
})
} else if (all) {
let allDatabases = await databasesList({
parseOutput: false
})

databaseIds.push(...allDatabases.databases.map((d) => d.$id));
databaseIds.push(...allDatabases.databases.map((d) => d.$id));
}

if(databaseIds.length <= 0) {
let answers = await inquirer.prompt(questionsInitCollection)
if (!answers.databases) process.exit(1)
databaseIds.push(...answers.databases);
if (databaseIds.length <= 0) {
let answers = await inquirer.prompt(questionsInitCollection)
if (!answers.databases) process.exit(1)
databaseIds.push(...answers.databases);
}

for(const databaseId of databaseIds) {
for (const databaseId of databaseIds) {
const database = await databasesGet({
databaseId,
parseOutput: false
Expand All @@ -181,7 +181,7 @@ const initCollection = async ({ all, databaseId } = {}) => {
// TODO: Pagination?
let response = await databasesListCollections({
databaseId,
queries: [ 'limit(100)' ],
queries: ['limit(100)'],
parseOutput: false
})

Expand All @@ -204,7 +204,7 @@ const initCollection = async ({ all, databaseId } = {}) => {
const initBucket = async () => {
// TODO: Pagination?
let response = await storageListBuckets({
queries: [ 'limit(100)' ],
queries: ['limit(100)'],
parseOutput: false
})

Expand All @@ -222,7 +222,7 @@ const initBucket = async () => {
const initTeam = async () => {
// TODO: Pagination?
let response = await teamsList({
queries: [ 'limit(100)' ],
queries: ['limit(100)'],
parseOutput: false
})

Expand Down

0 comments on commit 9957188

Please sign in to comment.