UNPKG

@eagleoutice/flowr-dev

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

46 lines (45 loc) 2.77 kB
import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format'; import { executeConfigQuery } from './config-query-executor'; import { type OutputFormatter } from '../../../util/text/ansi'; import Joi from 'joi'; import { FlowrConfig } from '../../../config'; import type { DeepPartial } from 'ts-essentials'; import type { ParsedQueryLine, Query } from '../../query'; import type { ReplOutput } from '../../../cli/repl/commands/repl-main'; import { type CommandCompletions } from '../../../cli/repl/core'; import type { ProjectKind } from '../../../project/context/project-kind'; export interface ConfigQuery extends BaseQueryFormat { readonly type: 'config'; readonly update?: DeepPartial<FlowrConfig>; /** a `.`-separated path to inspect (read) a single config value instead of dumping the whole config (repl: `path`, which also accepts a `*`/`**` glob) */ readonly inspect?: readonly string[]; /** discard every runtime update made so far, reverting to the config the analyzer was created with (repl: `+reset`) */ readonly reset?: boolean; } export interface ConfigQueryResult extends BaseQueryResult { readonly config: FlowrConfig; /** the project-kind specialization applied to {@link config}, if any (surfaced in the repl summary) */ readonly specialization?: { readonly kind: ProjectKind; readonly overwrite: DeepPartial<FlowrConfig>; }; } declare function configReplCompleter(partialLine: readonly string[], startingNewArg: boolean, _config: FlowrConfig): CommandCompletions; /** * The first schema violation (an unknown key or a wrong-typed value) in a config update, or `undefined` if it is * valid. Shared by the repl line parser and the {@link executeConfigQuery|executor}, so a programmatic or JSON-API * update is validated exactly like a `:config +key=value` line and never merges junk or a mistyped value. */ export declare function validateConfigUpdate(update: DeepPartial<FlowrConfig>, formatter?: OutputFormatter): string | undefined; declare function configQueryLineParser(output: ReplOutput, line: readonly string[], _config: FlowrConfig): ParsedQueryLine<'config'>; export declare const ConfigQueryDefinition: { readonly title: "Config Query"; readonly syntax: "@config [<path> | <glob>] | @config +<path>=<value> | @config +reset"; readonly executor: typeof executeConfigQuery; readonly asciiSummarizer: (formatter: OutputFormatter, _analyzer: unknown, queryResults: BaseQueryResult, result: string[], queries: readonly Query[]) => true; readonly completer: typeof configReplCompleter; readonly fromLine: typeof configQueryLineParser; readonly schema: Joi.ObjectSchema<any>; readonly flattenInvolvedNodes: () => never[]; }; export {};