@catladder/cli
Version:
Panter cli tool for cloud CI/CD and DevOps
21 lines • 881 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const child_process_promise_1 = require("child-process-promise");
const command_exists_promise_1 = __importDefault(require("command-exists-promise"));
let cmd;
exports.default = async () => {
var _a, _b;
if (!cmd) {
cmd =
(_b = (_a = process.env.VISUAL) !== null && _a !== void 0 ? _a : process.env.EDITOR) !== null && _b !== void 0 ? _b : ((await (0, command_exists_promise_1.default)("code")) ? "code --wait" : "vim");
}
return {
open: async (path) => {
await (0, child_process_promise_1.spawn)(`${cmd} ${path}`, { shell: true, stdio: "inherit" });
},
};
};
//# sourceMappingURL=getEditor.js.map