MCPcopy
hub / github.com/di-sukharev/opencommit / getPathInfo

Function getPathInfo

out/cli.cjs:1137–1156  ·  view source on GitHub ↗
(cmd, opt)

Source from the content-addressed store, hash-verified

1135 var isexe = require_isexe();
1136 var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
1137 var getPathInfo = (cmd, opt) => {
1138 const colon = opt.colon || COLON;
1139 const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
1140 // windows always checks the cwd first
1141 ...isWindows ? [process.cwd()] : [],
1142 ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
1143 "").split(colon)
1144 ];
1145 const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
1146 const pathExt = isWindows ? pathExtExe.split(colon) : [""];
1147 if (isWindows) {
1148 if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
1149 pathExt.unshift("");
1150 }
1151 return {
1152 pathEnv,
1153 pathExt,
1154 pathExtExe
1155 };
1156 };
1157 var which = (cmd, opt, cb) => {
1158 if (typeof opt === "function") {
1159 cb = opt;

Callers 2

whichFunction · 0.85
whichSyncFunction · 0.85

Calls 1

matchMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…