From 06c7f6a3267ac1d8d86923610687f6e09de5349d Mon Sep 17 00:00:00 2001 From: Julien Eluard Date: Wed, 14 Feb 2024 15:14:44 +0100 Subject: [PATCH] feat: make start command default for prover CLI --- packages/prover/README.md | 2 +- packages/prover/src/cli/cli.ts | 10 ++-------- packages/prover/src/cli/cmds/index.ts | 6 +----- packages/prover/src/cli/cmds/start/index.ts | 2 +- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/packages/prover/README.md b/packages/prover/README.md index 290766219e79..fda11331c7b0 100644 --- a/packages/prover/README.md +++ b/packages/prover/README.md @@ -39,7 +39,7 @@ You can also invoke the package as binary. ```bash npm -i g @lodestar/prover -lodestar-prover start \ +lodestar-prover \ --network sepolia \ --execution-rpc https://lodestar-sepoliarpc.chainsafe.io \ --mode rest \ diff --git a/packages/prover/src/cli/cli.ts b/packages/prover/src/cli/cli.ts index 8ef53e781a40..e614ff01f2fd 100644 --- a/packages/prover/src/cli/cli.ts +++ b/packages/prover/src/cli/cli.ts @@ -3,7 +3,7 @@ import yargs from "yargs"; import {hideBin} from "yargs/helpers"; import {registerCommandToYargs} from "../utils/command.js"; import {getVersionData} from "../utils/version.js"; -import {cmds} from "./cmds/index.js"; +import {proverProxyStartCommand} from "./cmds/index.js"; import {globalOptions} from "./options.js"; const {version} = getVersionData(); @@ -43,13 +43,7 @@ export function getLodestarProverCli(): yargs.Argv { .alias("v", "version") .recommendCommands(); - // yargs.command and all ./cmds - for (const cmd of cmds) { - registerCommandToYargs(prover, cmd); - } - - // throw an error if we see an unrecognized cmd - prover.recommendCommands().strict(); + registerCommandToYargs(prover, proverProxyStartCommand); return prover; } diff --git a/packages/prover/src/cli/cmds/index.ts b/packages/prover/src/cli/cmds/index.ts index 3b888ab41d83..843bc6c851e5 100644 --- a/packages/prover/src/cli/cmds/index.ts +++ b/packages/prover/src/cli/cmds/index.ts @@ -1,5 +1 @@ -import {CliCommand} from "../../utils/command.js"; -import {GlobalArgs} from "../options.js"; -import {proverProxyStartCommand} from "./start/index.js"; - -export const cmds: Required>>["subcommands"] = [proverProxyStartCommand]; +export {proverProxyStartCommand} from "./start/index.js"; diff --git a/packages/prover/src/cli/cmds/start/index.ts b/packages/prover/src/cli/cmds/start/index.ts index 76ad1bb3f260..2d231e3f8aea 100644 --- a/packages/prover/src/cli/cmds/start/index.ts +++ b/packages/prover/src/cli/cmds/start/index.ts @@ -4,7 +4,7 @@ import {proverProxyStartHandler} from "./handler.js"; import {StartArgs, startOptions} from "./options.js"; export const proverProxyStartCommand: CliCommand = { - command: "start", + command: "*", describe: "Start proxy server", examples: [ {