MCPcopy
hub / github.com/shelljs/shx / shouldReadStdin

Function shouldReadStdin

src/config.js:43–59  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

41 .split('');
42
43export const shouldReadStdin = (args) => {
44 const cmd = args[0];
45 const cmdInfo = SHELLJS_PIPE_INFO[cmd];
46 const parsedArgs = minimist(args.slice(1), {
47 stopEarly: true,
48 boolean: allOptionsList, // treat all short options as booleans
49 });
50 let requiredNumArgs = cmdInfo ? cmdInfo.minArgs : -1;
51
52 // If a non-boolean option is passed in, increment the required argument
53 // count (this is the case for `-n` for `head` and `tail`)
54 if (parsedArgs.n && (cmd === 'head' || cmd === 'tail')) {
55 requiredNumArgs++;
56 }
57
58 return Boolean(!process.stdin.isTTY && parsedArgs._.length < requiredNumArgs);
59};

Callers 2

cli.jsFile · 0.90
cli.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…