Skip to content

Commit

Permalink
Added a dedicated warning about the "--config" option being renamed t…
Browse files Browse the repository at this point in the history
…o "--config-path"
  • Loading branch information
fabiospampinato committed Apr 14, 2024
1 parent 393a105 commit d59ff91
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/bin.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env node

import { toKebabCase } from "kasi";
import { bin, color, parseArgv } from "specialist";
import { bin, color, exit, parseArgv } from "specialist";
import { PRETTIER_VERSION } from "./constants.js";
import { getPlugin, isNumber, normalizeOptions, normalizeFormatOptions, normalizePluginOptions } from "./utils.js";
import { getPlugin, isNumber, isString, normalizeOptions, normalizeFormatOptions, normalizePluginOptions } from "./utils.js";
import type { Bin, PluginsOptions } from "./types.js";

const makeBin = (): Bin => {
Expand Down Expand Up @@ -215,8 +215,20 @@ const makePluggableBin = async (): Promise<Bin> => {
return bin;
};

const runBin = async (): Promise<void> => {
const makeWarnedPluggableBin = async (): Promise<Bin> => {
const argv = process.argv.slice(2);
const args = parseArgv(argv);

if (isString(args["config"])) {
exit('The "--config" option has been renamed to "--config-path" instead');
}

const bin = await makePluggableBin();
return bin;
};

const runBin = async (): Promise<void> => {
const bin = await makeWarnedPluggableBin();
bin.run();
};

Expand Down

0 comments on commit d59ff91

Please sign in to comment.