Debian Codegraph @

cli/publish-spec/src/validation/validators/is-script.ts

raw symbols SCIP
1 import { questions, value } from "./helpers.js";
2 import type { RunOptions } from "../../types";
3 import type { Validator } from "../types";
4
5 interface RestValidation {
6 isScript: boolean;
7 }
8
9 export const validateIsScript: Validator<RestValidation> = async (options: RunOptions) => {
10 const { isScript, interactive } = options;
11 if (isScript || !interactive) return value({ isScript: Boolean(isScript) });
12 return questions({
13 type: "select",
14 name: "isScript",
15 message: "Is this spec adding completions to a local script (eg. ./scripts/my-script.sh)",
16 choices: [
17 { title: "No", value: false, selected: true, description: "(default)" },
18 { title: "Yes", value: true },
19 ],
20 });
21 };