UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

86 lines 3.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.scripts = void 0; exports.getValidOptionsForCompletion = getValidOptionsForCompletion; const options_1 = require("./options"); const repl_commands_1 = require("../repl/commands/repl-commands"); /** * We hold `_scripts` internally, as the modifiable variant and export the readonly scripts */ const _scripts = { 'slicer': { toolName: 'slicer', target: 'slicer-app', description: 'Static backwards executable slicer for R', options: options_1.slicerOptions, usageExample: 'slicer -c "12@product" test/testfiles/example.R', type: 'master script', }, 'benchmark': { toolName: 'benchmark', target: 'benchmark-app', description: 'Benchmark the static backwards slicer', type: 'master script', usageExample: 'benchmark "example-folder/"', options: options_1.benchmarkOptions }, 'benchmark-helper': { toolName: 'benchmark-single', target: 'benchmark-helper-app', description: 'Helper Script to Benchmark the Slicer', usageExample: 'benchmark-single "example.R" --output "example.json"', options: options_1.benchmarkHelperOptions, type: 'helper script', masterScripts: ['benchmark'] }, 'summarizer': { toolName: 'summarizer', target: 'summarizer-app', description: 'Summarize the results of the benchmark', options: options_1.summarizerOptions, usageExample: 'summarizer "benchmark.json"', type: 'master script', }, 'export-quads': { toolName: 'export-quads', target: 'export-quads-app', description: 'Export quads of the normalized AST of a given R code file', usageExample: 'export-quads "example.R" --output "example.quads"', options: options_1.exportQuadsOptions, type: 'master script', }, 'stats': { toolName: 'stats', target: 'statistics-app', description: 'Generate usage Statistics for R scripts', options: options_1.statisticOptions, usageExample: 'stats -i example.R --output-dir "output-folder/"', type: 'master script', }, 'stats-helper': { toolName: 'stats-helper', target: 'statistics-helper-app', description: 'Generate usage Statistics for a single R script (parallel helper for stats)', options: options_1.statisticHelperOptions, usageExample: 'stats-helper -i example.R --output-dir "output-folder/"', type: 'helper script', masterScripts: ['stats'] } }; exports.scripts = _scripts; /** * Given a set of option definitions and previously provided arguments, determine which options can still be added. */ function getValidOptionsForCompletion(options, prevArgs) { return options.filter(o => canAddOption(o, prevArgs)).flatMap(o => { const args = [(0, repl_commands_1.asOptionName)(o.name)]; if (o.alias) { args.push((0, repl_commands_1.asOptionName)(o.alias)); } return args; }); } function canAddOption(option, prevArgs) { return option.multiple || !prevArgs.includes((0, repl_commands_1.asOptionName)(option.name)) && (!option.alias || !prevArgs.includes((0, repl_commands_1.asOptionName)(option.alias))); } //# sourceMappingURL=scripts-info.js.map