command.js
This file
Path
lib/arguments/command.js
21 lines · 890 bytes · JavaScript
Last changed by
Harden some thingsSindre Sorhusbefore adoption4a0a121
History of this fileTake it
The walk stopped after 200 commits: lines older than 7cde496 point at it.
Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1–7why, one step back1import {logCommand} from '../verbose/start.js';2import {getVerboseInfo} from '../verbose/info.js';3import {getStartTime} from '../return/duration.js';4import {joinCommand} from './escape.js';5import {normalizeFdSpecificOption} from './specific.js';67// Compute `result.command`, `result.escapedCommand` and `verbose`-related informationAllow `verbose` option to be a function for custom logging (#1130)ehmickybefore adoption8daf348
line 8why, one step back8export const handleCommand = (filePath, rawArguments, rawOptions) => {Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 9–10why, one step back9 const startTime = getStartTime();10 const {command, escapedCommand} = joinCommand(filePath, rawArguments);Refactor `verbose` logic (#1126)ehmickybefore adoptionf9f1199
line 11why, one step back11 const verbose = normalizeFdSpecificOption(rawOptions, 'verbose');Harden some thingsSindre Sorhusbefore adoption4a0a121
lines 12–13why, one step back12 // Keep the null prototype, otherwise a polluted `Object.prototype` would inject option values13 const verboseInfo = getVerboseInfo(verbose, escapedCommand, {__proto__: null, ...rawOptions});Allow `verbose` option to be a function for custom logging (#1130)ehmickybefore adoption8daf348
line 14why, one step back14 logCommand(escapedCommand, verboseInfo);Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 15–21why, one step back15 return {16 command,17 escapedCommand,18 startTime,19 verboseInfo,20 };21};