Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

check-openapi: Modernize yargs usage.

Anders Kaseorg15cec69995d6
diff --git a/tools/check-openapi b/tools/check-openapi
index b7f5450ad77..76e25b44ca8 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");