diff --git a/src/cli.mjs b/src/cli.mjs index 3bd1323d..ffe31ed8 100644 --- a/src/cli.mjs +++ b/src/cli.mjs @@ -206,6 +206,7 @@ function buildYargs(argvInput) { }) .wrap(yargsInstance.terminalWidth()) .help("help", "Show help.") + .alias("help", "h") .fail(false) .exitProcess(false) .version() diff --git a/src/commands/database/create.mjs b/src/commands/database/create.mjs index 0a9c301d..9541486d 100644 --- a/src/commands/database/create.mjs +++ b/src/commands/database/create.mjs @@ -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"); @@ -76,7 +76,6 @@ function buildCreateCommand(yargs) { }, }) .check(validateDatabaseOrSecret) - .help("help", "show help") .example([ [ "$0 database create --name my_database --database us/example", diff --git a/src/commands/database/database.mjs b/src/commands/database/database.mjs index 80e6a60d..21bb1cbc 100644 --- a/src/commands/database/database.mjs +++ b/src/commands/database/database.mjs @@ -10,8 +10,7 @@ function buildDatabase(yargs) { .command(listCommand) .command(createCommand) .command(deleteCommand) - .demandCommand() - .help("help", "Show help."); + .demandCommand(); } export default { diff --git a/src/commands/database/delete.mjs b/src/commands/database/delete.mjs index f458445f..86bab93a 100644 --- a/src/commands/database/delete.mjs +++ b/src/commands/database/delete.mjs @@ -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"); @@ -49,7 +49,6 @@ function buildDeleteCommand(yargs) { }, }) .check(validateDatabaseOrSecret) - .help("help", "Show help.") .example([ [ "$0 database delete --name my_database --database us/example", diff --git a/src/commands/database/list.mjs b/src/commands/database/list.mjs index 066b548b..7a1ab0e0 100644 --- a/src/commands/database/list.mjs +++ b/src/commands/database/list.mjs @@ -85,7 +85,6 @@ function buildListCommand(yargs) { default: 1000, }, }) - .help("help", "Show help.") .example([ ["$0 database list", "List all top-level databases."], [ diff --git a/src/commands/key.mjs b/src/commands/key.mjs index 6d192699..019e0cae 100644 --- a/src/commands/key.mjs +++ b/src/commands/key.mjs @@ -36,7 +36,6 @@ function buildKeyCommand(yargs) { describe: "The role to assign to the key", }, }) - .help("help", "show help") .example([["$0 key create"]]); } diff --git a/src/commands/login.mjs b/src/commands/login.mjs index bfaf0ea1..e0cb0d5c 100644 --- a/src/commands/login.mjs +++ b/src/commands/login.mjs @@ -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 { diff --git a/src/commands/query.mjs b/src/commands/query.mjs index 151ee47c..ac896102 100644 --- a/src/commands/query.mjs +++ b/src/commands/query.mjs @@ -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 { diff --git a/src/commands/schema/abandon.mjs b/src/commands/schema/abandon.mjs index 5515f315..02658414 100644 --- a/src/commands/schema/abandon.mjs +++ b/src/commands/schema/abandon.mjs @@ -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 { diff --git a/src/commands/schema/commit.mjs b/src/commands/schema/commit.mjs index b028b24b..6a93ca85 100644 --- a/src/commands/schema/commit.mjs +++ b/src/commands/schema/commit.mjs @@ -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 { diff --git a/src/commands/schema/diff.mjs b/src/commands/schema/diff.mjs index ea9311a7..68a1db83 100644 --- a/src/commands/schema/diff.mjs +++ b/src/commands/schema/diff.mjs @@ -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 { diff --git a/src/commands/schema/pull.mjs b/src/commands/schema/pull.mjs index ba9c32e5..fdce8b32 100644 --- a/src/commands/schema/pull.mjs +++ b/src/commands/schema/pull.mjs @@ -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 { diff --git a/src/commands/schema/push.mjs b/src/commands/schema/push.mjs index 54917d6f..215debe5 100644 --- a/src/commands/schema/push.mjs +++ b/src/commands/schema/push.mjs @@ -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 { diff --git a/src/commands/schema/schema.mjs b/src/commands/schema/schema.mjs index 7beff0b3..40873b23 100644 --- a/src/commands/schema/schema.mjs +++ b/src/commands/schema/schema.mjs @@ -24,8 +24,7 @@ function buildSchema(yargs) { .command(pushCommand) .command(pullCommand) .command(statusCommand) - .demandCommand() - .help("help", "Show help."); + .demandCommand(); } export default { diff --git a/src/commands/schema/status.mjs b/src/commands/schema/status.mjs index d6c2a364..48943a29 100644 --- a/src/commands/schema/status.mjs +++ b/src/commands/schema/status.mjs @@ -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 { diff --git a/src/commands/shell.mjs b/src/commands/shell.mjs index 327052f6..78f20285 100644 --- a/src/commands/shell.mjs +++ b/src/commands/shell.mjs @@ -161,8 +161,7 @@ function buildShellCommand(yargs) { "Run queries in the database scoped to a secret.", ], ]) - .version(false) - .help("help", "Show help."); + .version(false); } export default {