Skip to content

Commit d59ff91

Browse files
Added a dedicated warning about the "--config" option being renamed to "--config-path"
1 parent 393a105 commit d59ff91

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/bin.ts

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/usr/bin/env node
22

33
import { toKebabCase } from "kasi";
4-
import { bin, color, parseArgv } from "specialist";
4+
import { bin, color, exit, parseArgv } from "specialist";
55
import { PRETTIER_VERSION } from "./constants.js";
6-
import { getPlugin, isNumber, normalizeOptions, normalizeFormatOptions, normalizePluginOptions } from "./utils.js";
6+
import { getPlugin, isNumber, isString, normalizeOptions, normalizeFormatOptions, normalizePluginOptions } from "./utils.js";
77
import type { Bin, PluginsOptions } from "./types.js";
88

99
const makeBin = (): Bin => {
@@ -215,8 +215,20 @@ const makePluggableBin = async (): Promise<Bin> => {
215215
return bin;
216216
};
217217

218-
const runBin = async (): Promise<void> => {
218+
const makeWarnedPluggableBin = async (): Promise<Bin> => {
219+
const argv = process.argv.slice(2);
220+
const args = parseArgv(argv);
221+
222+
if (isString(args["config"])) {
223+
exit('The "--config" option has been renamed to "--config-path" instead');
224+
}
225+
219226
const bin = await makePluggableBin();
227+
return bin;
228+
};
229+
230+
const runBin = async (): Promise<void> => {
231+
const bin = await makeWarnedPluggableBin();
220232
bin.run();
221233
};
222234

0 commit comments

Comments
 (0)