From 15cec69995d6700b2b0ec895f31abd03d2037e83 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Mon, 8 Apr 2024 16:29:37 -0700 Subject: [PATCH] check-openapi: Modernize yargs usage. Signed-off-by: Anders Kaseorg --- tools/check-openapi | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/check-openapi b/tools/check-openapi index b7f5450ad7..76e25b44ca 100755 --- a/tools/check-openapi +++ b/tools/check-openapi @@ -9,12 +9,15 @@ const ExampleValidator = require("openapi-examples-validator"); const Prettier = require("prettier"); const SwaggerParser = require("swagger-parser"); const {Composer, CST, LineCounter, Parser, Scalar, YAMLMap, YAMLSeq, visit} = require("yaml"); -const yargs = require("yargs"); +const {hideBin} = require("yargs/helpers"); +const yargs = require("yargs/yargs"); -const {argv} = yargs.option("fix", { - type: "boolean", - description: "Automatically fix some problems", -}); +const argv = yargs(hideBin(process.argv)) + .option("fix", { + type: "boolean", + description: "Automatically fix some problems", + }) + .parse(); async function checkFile(file) { const yaml = await fs.promises.readFile(file, "utf8");