Skip to content
Myr

command.js

This file

Path

lib/arguments/command.js

22 lines · 966 bytes · JavaScript

Last changed by

Fix `escapedCommand` and `verbose` quoting arguments when using the `shell` optionSindre Sorhusbefore adoptionb2c3a54

History of this file

Take it

The walk stopped after 200 commits: lines older than 9f65b86 point at it.

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 1–7why, one step back
1import {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 information

Allow `verbose` option to be a function for custom logging (#1130)ehmickybefore adoption8daf348

line 8why, one step back
8export const handleCommand = (filePath, rawArguments, rawOptions) => {

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 9why, one step back
9 const startTime = getStartTime();

Fix `escapedCommand` and `verbose` quoting arguments when using the `shell` optionSindre Sorhusbefore adoptionb2c3a54

lines 10–11why, one step back
10 // The `node` option ignores `shell`
11 const {command, escapedCommand} = joinCommand(filePath, rawArguments, rawOptions.shell && !rawOptions.node);

Refactor `verbose` logic (#1126)ehmickybefore adoptionf9f1199

line 12why, one step back
12 const verbose = normalizeFdSpecificOption(rawOptions, 'verbose');

Harden some thingsSindre Sorhusbefore adoption4a0a121

lines 13–14why, one step back
13 // Keep the null prototype, otherwise a polluted `Object.prototype` would inject option values
14 const verboseInfo = getVerboseInfo(verbose, escapedCommand, {__proto__: null, ...rawOptions});

Allow `verbose` option to be a function for custom logging (#1130)ehmickybefore adoption8daf348

line 15why, one step back
15 logCommand(escapedCommand, verboseInfo);

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 16–22why, one step back
16 return {
17 command,18 escapedCommand,19 startTime,20 verboseInfo,21 };22};