From be84c20647d4c6fb0223db31dad85f3fb490d2cb Mon Sep 17 00:00:00 2001 From: Julien Eluard Date: Wed, 14 Feb 2024 21:36:22 +0100 Subject: [PATCH] feat: make start command default for prover CLI --- packages/prover/README.md | 2 +- packages/prover/src/cli/cli.ts | 5 ++++- packages/prover/src/cli/cmds/index.ts | 1 + packages/prover/src/cli/cmds/start/index.ts | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/prover/README.md b/packages/prover/README.md index 290766219e79..0489756a066a 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 proxy \ --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..279d9015c799 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 {cmds, proverProxyStartCommand} from "./cmds/index.js"; import {globalOptions} from "./options.js"; const {version} = getVersionData(); @@ -48,6 +48,9 @@ export function getLodestarProverCli(): yargs.Argv { registerCommandToYargs(prover, cmd); } + // Register the proxy command as the default one + registerCommandToYargs(prover, {...proverProxyStartCommand, command: '*'}); + // throw an error if we see an unrecognized cmd prover.recommendCommands().strict(); diff --git a/packages/prover/src/cli/cmds/index.ts b/packages/prover/src/cli/cmds/index.ts index 3b888ab41d83..ecd2dae1da99 100644 --- a/packages/prover/src/cli/cmds/index.ts +++ b/packages/prover/src/cli/cmds/index.ts @@ -1,5 +1,6 @@ import {CliCommand} from "../../utils/command.js"; import {GlobalArgs} from "../options.js"; import {proverProxyStartCommand} from "./start/index.js"; +export {proverProxyStartCommand} from "./start/index.js"; export const cmds: Required>>["subcommands"] = [proverProxyStartCommand]; diff --git a/packages/prover/src/cli/cmds/start/index.ts b/packages/prover/src/cli/cmds/start/index.ts index 76ad1bb3f260..2b49a6466a61 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: "proxy", describe: "Start proxy server", examples: [ {