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 -h alias for help #483

Merged
merged 1 commit into from
Dec 5, 2024
Merged
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
1 change: 1 addition & 0 deletions src/cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ function buildYargs(argvInput) {
})
.wrap(yargsInstance.terminalWidth())
.help("help", "Show help.")
.alias("help", "h")
.fail(false)
.exitProcess(false)
.version()
Expand Down
3 changes: 1 addition & 2 deletions src/commands/database/create.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import { FaunaError } from "fauna";

import { container } from "../../cli.mjs";
import { validateDatabaseOrSecret } from "../../lib/command-helpers.mjs";
import { throwForError } from "../../lib/fauna.mjs";
import { getSecret, retryInvalidCredsOnce } from "../../lib/fauna-client.mjs";
import { formatObjectForShell } from "../../lib/misc.mjs";
import { validateDatabaseOrSecret } from "../../lib/command-helpers.mjs";

async function runCreateQuery(secret, argv) {
const { fql } = container.resolve("fauna");
Expand Down Expand Up @@ -76,7 +76,6 @@ function buildCreateCommand(yargs) {
},
})
.check(validateDatabaseOrSecret)
.help("help", "show help")
.example([
[
"$0 database create --name my_database --database us/example",
Expand Down
3 changes: 1 addition & 2 deletions src/commands/database/database.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ function buildDatabase(yargs) {
.command(listCommand)
.command(createCommand)
.command(deleteCommand)
.demandCommand()
.help("help", "Show help.");
.demandCommand();
}

export default {
Expand Down
3 changes: 1 addition & 2 deletions src/commands/database/delete.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import { FaunaError } from "fauna";

import { container } from "../../cli.mjs";
import { validateDatabaseOrSecret } from "../../lib/command-helpers.mjs";
import { throwForError } from "../../lib/fauna.mjs";
import { getSecret, retryInvalidCredsOnce } from "../../lib/fauna-client.mjs";
import { validateDatabaseOrSecret } from "../../lib/command-helpers.mjs";

async function runDeleteQuery(secret, argv) {
const { fql } = container.resolve("fauna");
Expand Down Expand Up @@ -49,7 +49,6 @@ function buildDeleteCommand(yargs) {
},
})
.check(validateDatabaseOrSecret)
.help("help", "Show help.")
.example([
[
"$0 database delete --name my_database --database us/example",
Expand Down
1 change: 0 additions & 1 deletion src/commands/database/list.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ function buildListCommand(yargs) {
default: 1000,
},
})
.help("help", "Show help.")
.example([
["$0 database list", "List all top-level databases."],
[
Expand Down
1 change: 0 additions & 1 deletion src/commands/key.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ function buildKeyCommand(yargs) {
describe: "The role to assign to the key",
},
})
.help("help", "show help")
.example([["$0 key create"]]);
}

Expand Down
10 changes: 4 additions & 6 deletions src/commands/login.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,10 @@ function buildLoginCommand(yargs) {
description: "User to log in as.",
default: "default",
},
})
.example([
["$0 login", "Log in as the 'default' user."],
["$0 login --user john_doe", "Log in as the 'john_doe' user."],
])
.help("help", "Show help.");
}).example([
["$0 login", "Log in as the 'default' user."],
["$0 login --user john_doe", "Log in as the 'john_doe' user."],
]);
}

export default {
Expand Down
3 changes: 1 addition & 2 deletions src/commands/query.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,7 @@ function buildQueryCommand(yargs) {
"$0 query -i /path/to/queries.fql --extra --output /tmp/result.json --database us/example",
"Run the query and write the full API response to a file.",
],
])
.help("help", "Show help.");
]);
}

export default {
Expand Down
3 changes: 1 addition & 2 deletions src/commands/schema/abandon.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ function buildAbandonCommand(yargs) {
"$0 schema abandon --database us/example --no-input",
"Run the command without input prompts.",
],
])
.help("help", "Show help.");
]);
}

export default {
Expand Down
3 changes: 1 addition & 2 deletions src/commands/schema/commit.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ function buildCommitCommand(yargs) {
"$0 schema commit --database us/example --no-input",
"Run the command without input prompts.",
],
])
.help("help", "Show help.");
]);
}

export default {
Expand Down
3 changes: 1 addition & 2 deletions src/commands/schema/diff.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ function buildDiffCommand(yargs) {
"$0 schema diff --database us/example --dir /path/to/schema --text",
"Show a text diff instead of a semantic diff.",
],
])
.help("help", "Show help.");
]);
}

export default {
Expand Down
3 changes: 1 addition & 2 deletions src/commands/schema/pull.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ function buildPullCommand(yargs) {
"$0 schema pull --database us/example --dir /path/to/schema --delete",
"Delete `.fsl` files in the local directory that are not part of the pulled schema.",
],
])
.help("help", "Show help.");
]);
}

export default {
Expand Down
3 changes: 1 addition & 2 deletions src/commands/schema/push.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ function buildPushCommand(yargs) {
"$0 schema push --database us/example --dir /path/to/schema --no-input",
"Run the command without input prompts.",
],
])
.help("help", "Show help.");
]);
}

export default {
Expand Down
3 changes: 1 addition & 2 deletions src/commands/schema/schema.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ function buildSchema(yargs) {
.command(pushCommand)
.command(pullCommand)
.command(statusCommand)
.demandCommand()
.help("help", "Show help.");
.demandCommand();
}

export default {
Expand Down
22 changes: 10 additions & 12 deletions src/commands/schema/status.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,16 @@ async function doStatus(argv) {
}

function buildStatusCommand(yargs) {
return yargsWithCommonQueryOptions(yargs)
.example([
[
"$0 schema status --database us/example",
"Get the staged schema status for the 'us/example' database.",
],
[
"$0 schema status --secret my-secret",
"Get the staged schema status for the database scoped to a secret.",
],
])
.help("help", "Show help.");
return yargsWithCommonQueryOptions(yargs).example([
[
"$0 schema status --database us/example",
"Get the staged schema status for the 'us/example' database.",
],
[
"$0 schema status --secret my-secret",
"Get the staged schema status for the database scoped to a secret.",
],
]);
}

export default {
Expand Down
3 changes: 1 addition & 2 deletions src/commands/shell.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
prompt: `${argv.db_path || ""}> `,
ignoreUndefined: true,
preview: argv.apiVersion !== "10",
// TODO: integrate with fql-analyzer for completions

Check warning on line 27 in src/commands/shell.mjs

View workflow job for this annotation

GitHub Actions / lint

Unexpected 'todo' comment: 'TODO: integrate with fql-analyzer for...'
completer: argv.apiVersion === "10" ? () => [] : undefined,
output: container.resolve("stdoutStream"),
input: container.resolve("stdinStream"),
Expand Down Expand Up @@ -161,8 +161,7 @@
"Run queries in the database scoped to a secret.",
],
])
.version(false)
.help("help", "Show help.");
.version(false);
}

export default {
Expand Down
Loading