summaryrefslogtreecommitdiff
path: root/format.ts
blob: a29a53d3fa0b632b7ca0f55b2be08834ba1b9ed5 (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
#!/usr/bin/env deno --allow-run --allow-write
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import { exit, args } from "deno";
import { parse } from "./flags/mod.ts";
import { xrun, executableSuffix } from "./prettier/util.ts";

async function main(opts) {
  const args = [
    `deno${executableSuffix}`,
    "--allow-write",
    "--allow-run",
    "prettier/main.ts",
    "--ignore",
    "testdata",
    "--ignore",
    "vendor"
  ];

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

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

main(parse(args));