command.js
This file
Path
lib/arguments/command.js
20 lines · 777 bytes · JavaScript
Last changed by
Allow `verbose` option to be a function for custom logging (#1130)ehmickybefore adoption8daf348
History of this fileTake it
123456789101112131415161718192021import {logCommand} from '../verbose/start.js';import {getVerboseInfo} from '../verbose/info.js';import {getStartTime} from '../return/duration.js';import {joinCommand} from './escape.js';import {normalizeFdSpecificOption} from './specific.js';
// Compute `result.command`, `result.escapedCommand` and `verbose`-related informationexport const handleCommand = (filePath, rawArguments, rawOptions) => { const startTime = getStartTime(); const {command, escapedCommand} = joinCommand(filePath, rawArguments); const verbose = normalizeFdSpecificOption(rawOptions, 'verbose'); const verboseInfo = getVerboseInfo(verbose, escapedCommand, {...rawOptions}); logCommand(escapedCommand, verboseInfo); return { command, escapedCommand, startTime, verboseInfo, };};