|
|
@@ -3,6 +3,7 @@ import 'zx/globals';
|
|
|
import {
|
|
|
cliArguments,
|
|
|
getToolchainArgument,
|
|
|
+ partitionArguments,
|
|
|
popArgument,
|
|
|
workingDirectory,
|
|
|
} from '../utils.mjs';
|
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
const formatArgs = cliArguments();
|
|
|
|
|
|
const fix = popArgument(formatArgs, '--fix');
|
|
|
+const [cargoArgs, fmtArgs] = partitionArguments(formatArgs, '--');
|
|
|
const toolchain = getToolchainArgument('format');
|
|
|
const manifestPath = path.join(
|
|
|
workingDirectory,
|
|
|
@@ -22,7 +24,7 @@ const manifestPath = path.join(
|
|
|
|
|
|
// Format the client.
|
|
|
if (fix) {
|
|
|
- await $`cargo ${toolchain} fmt --manifest-path ${manifestPath} -- ${formatArgs}`;
|
|
|
+ await $`cargo ${toolchain} fmt --manifest-path ${manifestPath} ${cargoArgs} -- ${fmtArgs}`;
|
|
|
} else {
|
|
|
- await $`cargo ${toolchain} fmt --manifest-path ${manifestPath} -- --check ${formatArgs}`;
|
|
|
+ await $`cargo ${toolchain} fmt --manifest-path ${manifestPath} ${cargoArgs} -- --check ${fmtArgs}`;
|
|
|
}
|