Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/src/command/check/cmd.ts
6449 views
1
/*
2
* cmd.ts
3
*
4
* Copyright (C) 2021-2022 Posit Software, PBC
5
*/
6
7
import { Command } from "cliffy/command/mod.ts";
8
import { check, enforceTargetType } from "./check.ts";
9
import { initializeProjectContextAndEngines } from "../command-utils.ts";
10
11
export const checkCommand = new Command()
12
.name("check")
13
.option("--output <path>", "Output as JSON to a file")
14
.option(
15
"--no-strict",
16
"When set, will not fail if dependency versions don't match precisely",
17
)
18
.arguments("[target:string]")
19
.description(
20
"Verify correct functioning of Quarto installation.\n\n" +
21
"Check specific functionality with argument install, jupyter, knitr, or all.",
22
)
23
.example("Check Quarto installation", "quarto check install")
24
.example("Check Jupyter engine", "quarto check jupyter")
25
.example("Check Knitr engine", "quarto check knitr")
26
.example("Check installation and all engines", "quarto check all")
27
// deno-lint-ignore no-explicit-any
28
.action(async (options: any, targetStr?: string) => {
29
targetStr = targetStr || "all";
30
31
// Initialize project context and register external engines
32
await initializeProjectContextAndEngines();
33
34
// Validate target (now that all engines including external ones are loaded)
35
const target = enforceTargetType(targetStr);
36
37
await check(
38
target,
39
options.strict,
40
options.output,
41
);
42
});
43
44