Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add first draft of interactive init command #497

Open
wants to merge 1 commit into
base: v3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
833 changes: 170 additions & 663 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"faunadb": "^4.8.2",
"has-ansi": "^6.0.0",
"inquirer": "^12.0.0",
"inquirer-file-selector": "^0.6.1",
"luxon": "^3.5.0",
"open": "10.1.0",
"shiki": "^1.15.2",
Expand Down
12 changes: 11 additions & 1 deletion src/cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import yargs from "yargs";

import databaseCommand from "./commands/database/database.mjs";
import initCommand from "./commands/init.mjs";
import localCommand from "./commands/local.mjs";
import loginCommand from "./commands/login.mjs";
import queryCommand from "./commands/query.mjs";
Expand Down Expand Up @@ -118,6 +119,7 @@
.command(schemaCommand)
.command(databaseCommand)
.command(localCommand)
.command(initCommand)
.demandCommand()
.strictCommands(true)
.completion(
Expand All @@ -141,7 +143,7 @@
.filter((key) => previousWord === key)
.pop();

// TODO: this doesn't handle aliasing, and it needs to

Check warning on line 146 in src/cli.mjs

View workflow job for this annotation

GitHub Actions / lint

Unexpected 'todo' comment: 'TODO: this doesn't handle aliasing, and...'
if (
currentWord === "--profile" ||
currentWordFlag === "profile" ||
Expand Down Expand Up @@ -200,7 +202,15 @@
"Components to emit logs for. Overrides the --verbosity flag. Pass values as a space-separated list. Ex: --verbose-component fetch error.",
type: "array",
default: [],
choices: ["argv", "completion", "config", "creds", "error", "fetch"],
choices: [
"argv",
"command",
"completion",
"config",
"creds",
"error",
"fetch",
],
group: "Debug:",
},
verbosity: {
Expand Down
9 changes: 7 additions & 2 deletions src/commands/database/list.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@ import { faunaToCommandError } from "../../lib/fauna.mjs";
import { FaunaAccountClient } from "../../lib/fauna-account-client.mjs";
import { colorize, Format } from "../../lib/formatting/colorize.mjs";

async function listDatabasesWithAccountAPI(argv) {
export async function listDatabasesWithAccountAPI(argv) {
const { pageSize, database } = argv;
const accountClient = new FaunaAccountClient();
const response = await accountClient.listDatabases({
pageSize,
path: database,
});

return response.results.map(({ path, name }) => ({ path, name }));
// eslint-disable-next-line camelcase
return response.results.map(({ path, name, region_group }) => ({
path,
name,
regionGroup: region_group, // eslint-disable-line camelcase
}));
}

async function listDatabasesWithSecret(argv) {
Expand Down
Loading
Loading