-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
31 lines (31 loc) · 968 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env node
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const scripts_1 = __importDefault(require("./source/scripts"));
const stylePrint_1 = __importDefault(require("./source/stylePrint"));
// Function to handle interruption (Ctrl + C)
const handleInterrupt = () => {
process.exit(1);
};
// Set up the interrupt event listener
process.on("SIGINT", handleInterrupt);
// Your Enquirer prompt
const ScriptIntruption = async () => {
try {
await (0, scripts_1.default)();
}
catch (error) {
(0, stylePrint_1.default)(`
Oh, Ok
hope See you again! ❣️`);
}
finally {
// Remove the event listener when the prompt is completed
process.removeListener("SIGINT", handleInterrupt);
}
};
// Call the function
ScriptIntruption();