From 24774098e172ae3178e9b729371cf27f902e33aa Mon Sep 17 00:00:00 2001 From: Ermal Kaleci Date: Thu, 31 Oct 2024 00:29:55 +0100 Subject: [PATCH] update --- packages/chopsticks/src/cli.ts | 4 +++- packages/chopsticks/src/schema/index.ts | 6 +----- packages/chopsticks/src/schema/options.test.ts | 6 ++++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/chopsticks/src/cli.ts b/packages/chopsticks/src/cli.ts index 0c470b7c..2ad95fdd 100644 --- a/packages/chopsticks/src/cli.ts +++ b/packages/chopsticks/src/cli.ts @@ -45,7 +45,8 @@ const commands = yargs(hideBin(process.argv)) 'Path to config file with default options', () => ({}), // we load config in middleware ) - .options(getYargsOptions(configSchema.shape)), + .options(getYargsOptions(configSchema.shape)) + .deprecateOption('addr', '⚠️ Use --host instead.'), async (argv) => { await setupWithServer(configSchema.parse(argv)) }, @@ -101,6 +102,7 @@ const commands = yargs(hideBin(process.argv)) .alias('wasm-override', 'w') .usage('Usage: $0 [options]') .example('$0', '-c acala') + .showHelpOnFail(false) if (!environment.DISABLE_PLUGINS) { pluginExtendCli( diff --git a/packages/chopsticks/src/schema/index.ts b/packages/chopsticks/src/schema/index.ts index 94e735de..04dfd7da 100644 --- a/packages/chopsticks/src/schema/index.ts +++ b/packages/chopsticks/src/schema/index.ts @@ -12,11 +12,7 @@ export const zHex = z.custom((val: any) => /^0x\w+$/.test(val)) export const zHash = z.string().length(66).and(zHex) export const configSchema = z.object({ - addr: z - .union([z.literal('localhost'), z.string().ip()], { - description: '[DEPRECATED] Use --host instead', - }) - .optional(), + addr: z.union([z.literal('localhost'), z.string().ip()]).optional(), host: z .union([z.literal('localhost'), z.string().ip()], { description: 'Server listening interface', diff --git a/packages/chopsticks/src/schema/options.test.ts b/packages/chopsticks/src/schema/options.test.ts index cab60ffc..5e1cb939 100644 --- a/packages/chopsticks/src/schema/options.test.ts +++ b/packages/chopsticks/src/schema/options.test.ts @@ -4,6 +4,12 @@ import { expect, it } from 'vitest' it('get yargs options from zod schema', () => { expect(getYargsOptions(configSchema.shape)).toMatchInlineSnapshot(` { + "addr": { + "choices": undefined, + "demandOption": false, + "description": undefined, + "type": "string", + }, "allow-unresolved-imports": { "choices": undefined, "demandOption": false,