@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
518 lines (517 loc) • 22.9 kB
TypeScript
/**
* This file contains the references to all scripts, as well as their explanations and arguments.
* @module
*/
import type { OptionDefinition } from 'command-line-usage';
import type { MergeableRecord } from '../../util/objects';
interface BaseScriptInformation extends MergeableRecord {
/** name of the tool to present to the user */
toolName: string;
/** internal module name to fork/execute, make sure to use the correct path to it with the help of `__dirname` */
target: string;
/** description of the tool for the user */
description: string;
/** example usage */
usageExample: string;
/** command line options that are available */
options: OptionDefinition[];
}
export interface MasterScriptInformation extends BaseScriptInformation {
type: 'master script';
}
export interface HelperScriptInformation extends BaseScriptInformation {
type: 'helper script';
masterScripts: string[];
}
export type ScriptInformation = MasterScriptInformation | HelperScriptInformation;
/**
* We hold `_scripts` internally, as the modifiable variant and export the readonly scripts
*/
declare const _scripts: {
slicer: {
toolName: string;
target: string;
description: string;
options: [{
readonly name: "verbose";
readonly alias: "v";
readonly type: BooleanConstructor;
readonly description: "Run with verbose logging";
}, {
readonly name: "help";
readonly alias: "h";
readonly type: BooleanConstructor;
readonly description: "Print this usage guide";
}, {
readonly name: "input";
readonly alias: "i";
readonly type: StringConstructor;
readonly description: "(Required) Pass a single file to slice";
readonly multiple: false;
readonly defaultOption: true;
readonly typeLabel: "{underline files}";
}, {
readonly name: "input-is-text";
readonly alias: "r";
readonly type: BooleanConstructor;
readonly description: "Indicate, that the input is *not* a file, but R code to directly consume";
}, {
readonly name: "diff";
readonly alias: "d";
readonly type: BooleanConstructor;
readonly description: "This requires ansi-output and only works if the api option is not set. It visualizes the slice as a diff.";
}, {
readonly name: "criterion";
readonly alias: "c";
readonly type: StringConstructor;
readonly description: "(Required) Slicing criterion either in the form {underline line:col} or {underline line@variable}, multiple can be separated by '{bold ;}'. If you do not want to slice but only process the file, pass an empty string.";
readonly multiple: false;
}, {
readonly name: "stats";
readonly alias: "s";
readonly type: BooleanConstructor;
readonly description: "Print stats and write them to {italic <output>.stats} (runtimes etc.)";
readonly multiple: false;
}, {
readonly name: "output";
readonly alias: "o";
readonly type: StringConstructor;
readonly description: "File to write all the generated quads to (defaults to the commandline)";
readonly typeLabel: "{underline file}";
}, {
readonly name: "no-magic-comments";
readonly alias: "m";
readonly type: BooleanConstructor;
readonly description: "Disable the effects of magic comments which force lines to be included.";
}, {
readonly name: "api";
readonly type: BooleanConstructor;
readonly description: "Instead of human-readable output, dump a lot of json with the results of all intermediate steps.";
}];
usageExample: string;
type: string;
};
benchmark: {
toolName: string;
target: string;
description: string;
type: string;
usageExample: string;
options: [{
readonly name: "verbose";
readonly alias: "v";
readonly type: BooleanConstructor;
readonly description: "Run with verbose logging [do not use for the real benchmark as this affects the time measurements, but only to find errors]";
}, {
readonly name: "help";
readonly alias: "h";
readonly type: BooleanConstructor;
readonly description: "Print this usage guide";
}, {
readonly name: "limit";
readonly alias: "l";
readonly type: NumberConstructor;
readonly description: "Limit the number of files to process (if given, this will choose these files randomly and add the chosen names to the output";
}, {
readonly name: "runs";
readonly alias: "r";
readonly type: NumberConstructor;
readonly description: "The amount of benchmark runs that should be done, out of which an average will be calculated";
}, {
readonly name: "seed";
readonly type: StringConstructor;
readonly description: "The random seed for sampling the files if a limit is set, and for sampling the slicing criteria if a maximum is set";
}, {
readonly name: "input";
readonly alias: "i";
readonly type: StringConstructor;
readonly description: "Pass a folder or file as src to read from. Alternatively, pass a single JSON file that contains a list of paths.";
readonly multiple: true;
readonly defaultOption: true;
readonly defaultValue: readonly [];
readonly typeLabel: "{underline files/folders}";
}, {
readonly name: "parallel";
readonly alias: "p";
readonly type: StringConstructor;
readonly description: "Number of parallel executors (defaults to {italic max(cpu.count-1, 1)})";
readonly defaultValue: number;
readonly typeLabel: "{underline number}";
}, {
readonly name: "slice";
readonly alias: "s";
readonly type: StringConstructor;
readonly description: "Automatically slice for *all* variables (default) or *no* slicing and only parsing/dataflow construction. Numbers will indicate: sample X random slices from all.";
readonly defaultValue: "all";
readonly typeLabel: "{underline all/no}";
}, {
readonly name: "output";
readonly alias: "o";
readonly type: StringConstructor;
readonly description: `Folder to write all the measurements to in a per-file-basis (defaults to {italic benchmark-${string}})`;
readonly defaultValue: `benchmark-${string}`;
readonly typeLabel: "{underline folder}";
}, {
readonly name: "parser";
readonly type: StringConstructor;
readonly description: "The parser to use for the benchmark";
readonly defaultValue: "r-shell";
readonly typeLabel: "{underline parser}";
}, {
readonly name: "dataframe-shape-inference";
readonly type: BooleanConstructor;
readonly description: "Infer the shape of data frames using abstract interpretation (includes control flow graph extraction)";
readonly defaultValue: false;
}, {
readonly name: "max-file-slices";
readonly type: NumberConstructor;
readonly description: "If file has more than passed number of slices, the file is not processed";
readonly defaultValue: -1;
readonly typeLabel: "{underline number}";
}, {
readonly name: "threshold";
readonly alias: "t";
readonly type: NumberConstructor;
readonly description: "How many re-visits of the same node are ok?";
readonly defaultValue: undefined;
readonly typeLabel: "{underline number}";
}, {
readonly name: "per-file-time-limit";
readonly type: NumberConstructor;
readonly description: "Time limit in milliseconds to process single file (disabled by default)";
readonly defaultValue: undefined;
readonly typeLabel: "{underline number}";
}, {
readonly name: "sampling-strategy";
readonly type: StringConstructor;
readonly description: "Which strategy to use, when sampling is enabled";
readonly defaultValue: "random";
readonly typeLabel: "{underline random/equidistant}";
}, {
readonly name: "cfg";
readonly alias: "c";
readonly type: BooleanConstructor;
readonly description: "Extract the control flow graph of the file (benchmark it too)";
}, {
readonly name: "cg";
readonly type: BooleanConstructor;
readonly description: "Extract the call graph of the file (benchmark it too)";
}];
};
'benchmark-helper': {
toolName: string;
target: string;
description: string;
usageExample: string;
options: [{
readonly name: "verbose";
readonly alias: "v";
readonly type: BooleanConstructor;
readonly description: "Run with verbose logging [do not use for the real benchmark as this affects the time measurements, but only to find errors]";
}, {
readonly name: "help";
readonly alias: "h";
readonly type: BooleanConstructor;
readonly description: "Print this usage guide";
}, {
readonly name: "input";
readonly alias: "i";
readonly type: StringConstructor;
readonly description: "Pass a single file as src to read from";
readonly multiple: false;
readonly defaultOption: true;
readonly typeLabel: "{underline file}";
}, {
readonly name: "file-id";
readonly alias: "d";
readonly type: NumberConstructor;
readonly description: "A numeric file id that can be used to match an input and run-num to a file";
}, {
readonly name: "run-num";
readonly alias: "r";
readonly type: NumberConstructor;
readonly description: "The n-th time that the file with the given file-id is being benchmarked";
}, {
readonly name: "slice";
readonly alias: "s";
readonly type: StringConstructor;
readonly description: "Automatically slice for *all* variables (default) or *no* slicing and only parsing/dataflow construction. Numbers will indicate: sample X random slices from all.";
readonly defaultValue: "all";
readonly typeLabel: "{underline all/no}";
}, {
readonly name: "cfg";
readonly alias: "c";
readonly type: BooleanConstructor;
readonly description: "Extract the control flow graph of the file (benchmark it too)";
}, {
readonly name: "cg";
readonly type: BooleanConstructor;
readonly description: "Extract the call graph of the file (benchmark it too)";
}, {
readonly name: "output";
readonly alias: "o";
readonly type: StringConstructor;
readonly description: "File to write the measurements to (appends a single line in JSON format)";
readonly typeLabel: "{underline file}";
}, {
readonly name: "parser";
readonly type: StringConstructor;
readonly description: "The parser to use for the benchmark";
readonly defaultValue: "r-shell";
readonly typeLabel: "{underline parser}";
}, {
readonly name: "dataframe-shape-inference";
readonly type: BooleanConstructor;
readonly description: "Infer the shape of data frames using abstract interpretation (includes control flow graph extraction)";
readonly defaultValue: false;
}, {
readonly name: "max-slices";
readonly type: NumberConstructor;
readonly description: "If file has more than passed number of slices, the file is not processed";
readonly defaultValue: -1;
readonly typeLabel: "{underline number}";
}, {
readonly name: "threshold";
readonly alias: "t";
readonly type: NumberConstructor;
readonly description: "How many re-visits of the same node are ok?";
readonly defaultValue: undefined;
readonly typeLabel: "{underline number}";
}, {
readonly name: "sampling-strategy";
readonly type: StringConstructor;
readonly description: "Which strategy to use, when sampling is enabled";
readonly defaultValue: "random";
readonly typeLabel: "{underline random/equidistant}";
}, {
readonly name: "seed";
readonly type: StringConstructor;
readonly description: "The random seed for sampling the slicing criteria if a maximum is set";
}];
type: string;
masterScripts: string[];
};
summarizer: {
toolName: string;
target: string;
description: string;
options: [{
readonly name: "verbose";
readonly alias: "v";
readonly type: BooleanConstructor;
readonly description: "Run with verbose logging";
}, {
readonly name: "help";
readonly alias: "h";
readonly type: BooleanConstructor;
readonly description: "Print this usage guide";
}, {
readonly name: "type";
readonly alias: "t";
readonly type: StringConstructor;
readonly description: "Manually specify if you want to post-process benchmark results, statistics, or compressed statistics (defaults to auto).";
readonly defaultValue: "auto";
}, {
readonly name: "graph";
readonly alias: "g";
readonly type: BooleanConstructor;
readonly description: "Produce data to be used for visualizing benchmarks over time";
}, {
readonly name: "categorize";
readonly type: BooleanConstructor;
readonly description: "Categorize the results (e.g., \"test\", \"example\", ...)";
readonly defaultValue: false;
}, {
readonly name: "project-skip";
readonly type: NumberConstructor;
readonly description: "Skip the first n folders to find the location of projects";
readonly defaultValue: 0;
}, {
readonly name: "ultimate-only";
readonly alias: "u";
readonly type: BooleanConstructor;
readonly description: "Only perform the second summary-stage, with this, the input is used to find the summary-output.";
}, {
readonly name: "input";
readonly alias: "i";
readonly type: StringConstructor;
readonly description: "The {italic output} produced by the benchmark, the statistics, ...";
readonly defaultOption: true;
readonly multiple: false;
readonly typeLabel: "{underline file.json/output}";
}, {
readonly name: "output";
readonly alias: "o";
readonly type: StringConstructor;
readonly description: "Basename of the summaries (defaults to {italic <input>-summary})";
readonly typeLabel: "{underline file}";
}];
usageExample: string;
type: string;
};
'export-quads': {
toolName: string;
target: string;
description: string;
usageExample: string;
options: [{
readonly name: "verbose";
readonly alias: "v";
readonly type: BooleanConstructor;
readonly description: "Run with verbose logging";
}, {
readonly name: "help";
readonly alias: "h";
readonly type: BooleanConstructor;
readonly description: "Print this usage guide";
}, {
readonly name: "input";
readonly alias: "i";
readonly type: StringConstructor;
readonly description: "Pass a folder or file as src to read from";
readonly multiple: true;
readonly defaultOption: true;
readonly defaultValue: readonly [];
readonly typeLabel: "{underline files/folders}";
}, {
readonly name: "limit";
readonly alias: "l";
readonly type: NumberConstructor;
readonly description: "Limit the number of files to process";
}, {
readonly name: "output";
readonly alias: "o";
readonly type: StringConstructor;
readonly description: "File to write all the generated quads to (defaults to {italic out.quads})";
readonly typeLabel: "{underline file}";
}];
type: string;
};
stats: {
toolName: string;
target: string;
description: string;
options: [{
readonly name: "verbose";
readonly alias: "v";
readonly type: BooleanConstructor;
readonly description: "Run with verbose logging";
}, {
readonly name: "help";
readonly alias: "h";
readonly type: BooleanConstructor;
readonly description: "Print this usage guide";
}, {
readonly name: "limit";
readonly alias: "l";
readonly type: NumberConstructor;
readonly description: "Limit the number of files to process";
}, {
readonly name: "input";
readonly alias: "i";
readonly type: StringConstructor;
readonly description: "Pass a folder or file as src to read from";
readonly multiple: true;
readonly defaultOption: true;
readonly defaultValue: readonly [];
readonly typeLabel: "{underline files/folders}";
}, {
readonly name: "output-dir";
readonly alias: "o";
readonly type: StringConstructor;
readonly description: "Folder to write the output to";
readonly defaultValue: `${string}/statistics-out/${string}`;
readonly typeLabel: "{underline folder}";
}, {
readonly name: "dump-json";
readonly type: BooleanConstructor;
readonly description: "Write JSON output during the extraction";
readonly typeLabel: "{underline folder}";
}, {
readonly name: "no-ansi";
readonly type: BooleanConstructor;
readonly description: "Disable ansi-escape-sequences in the output. Useful, if you want to redirect the output to a file.";
}, {
readonly name: "parallel";
readonly alias: "p";
readonly type: StringConstructor;
readonly description: "Number of parallel executors (defaults to {italic max(cpu.count-1, 1)})";
readonly defaultValue: number;
readonly typeLabel: "{underline number}";
}, {
readonly name: "features";
readonly type: StringConstructor;
readonly description: `Features to track, supported are "all" or ${string}`;
readonly multiple: true;
readonly defaultValue: "all";
readonly typeLabel: "{underline names}";
}];
usageExample: string;
type: string;
};
'stats-helper': {
toolName: string;
target: string;
description: string;
options: [{
readonly name: "verbose";
readonly alias: "v";
readonly type: BooleanConstructor;
readonly description: "Run with verbose logging";
}, {
readonly name: "help";
readonly alias: "h";
readonly type: BooleanConstructor;
readonly description: "Print this usage guide";
}, {
readonly name: "input";
readonly alias: "i";
readonly type: StringConstructor;
readonly description: "Pass single file as src to read from";
readonly multiple: false;
readonly defaultOption: true;
readonly typeLabel: "{underline file}";
}, {
readonly name: "output-dir";
readonly alias: "o";
readonly type: StringConstructor;
readonly description: "Folder to write the output to";
readonly typeLabel: "{underline folder}";
}, {
readonly name: "root-dir";
readonly type: StringConstructor;
readonly description: "Root dir for the statistics files";
readonly defaultValue: "";
}, {
readonly name: "compress";
readonly type: BooleanConstructor;
readonly description: "Compress the output folder to a single file";
readonly defaultValue: false;
}, {
readonly name: "dump-json";
readonly type: BooleanConstructor;
readonly description: "Write JSON output during the extraction";
readonly typeLabel: "{underline folder}";
}, {
readonly name: "no-ansi";
readonly type: BooleanConstructor;
readonly description: "Disable ansi-escape-sequences in the output. Useful, if you want to redirect the output to a file.";
}, {
readonly name: "features";
readonly type: StringConstructor;
readonly description: `Features to track, supported are "all" or ${string}`;
readonly multiple: true;
readonly defaultValue: "all";
readonly typeLabel: "{underline names}";
}];
usageExample: string;
type: string;
masterScripts: string[];
};
};
export declare const scripts: Record<keyof typeof _scripts, ScriptInformation>;
/**
* Given a set of option definitions and previously provided arguments, determine which options can still be added.
*/
export declare function getValidOptionsForCompletion(options: readonly OptionDefinition[], prevArgs: readonly string[]): string[];
export {};