summaryrefslogtreecommitdiff
path: root/format.ts
blob: 08d1aaed9fa51118b99430af32796079665c987f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env -S deno run --allow-run --allow-write --allow-read --allow-env
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
const { exit, args, execPath } = Deno;
import { parse } from "./flags/mod.ts";
import { xrun } from "./prettier/util.ts";

async function main(opts): Promise<void> {
  const args = [
    execPath(),
    "run",
    "--allow-write",
    "--allow-read",
    "prettier/main.ts",
    "--ignore",
    "node_modules",
    "--ignore",
    "testdata",
    "--ignore",
    "vendor",
    "--write"
  ];

  if (opts.check) {
    args.push("--check");
  }

  args.push(".");

  exit((await xrun({ args }).status()).code);
}

main(parse(args));